Div <div>

Block-level/Inline?:Block-level (can contain just about anything that goes in the body)
Empty?:No

Div <div> is a generic block-level element. It does nothing except create a line before and after itself just like any other block-level element, by default, and has no semantic meaning. Unlike inline elements, there aren't a lot of block-level elements in XHTML that impart semantic meaning the way there is for inline elements, though <span> is still of use for complicated composite styles and JavaScript. Indeed, this is the point of many of the new HTML5 elements. <div> is typically used to to group items for stylistic purposes , such as with Absolute Positioning, and often represents different regions in the page (the new elements in HTML5 are a good examples of regions). Also, it can be used to group items for JavaScript to access.

Examples:

<!--Ctrl+U and peek at my code (click the stylesheet link in the link element)-->

<!--Give it a class-->
<!--Fourth of July
.theFourth{
    border:thick inset red;
    color:white;
    background-color:blue;
}
-->
<div class="theFourth">Happy 4th of July</div>

<!--Give it an id for JavaScript-->
<div class ="theFourth" id="big">Happy 4th of July</div>
<button onclick="document.getElementById('big').style.fontSize='30pt';
        document.getElementById('big').style.height='200px';">Bigger</button>

Example executing:

Happy 4th of July


Happy 4th of July

Back to Knowledge Dump