HTML and CSS Reference
In-Depth Information
Marking a Section with the div Element
The structural elements are part of the current specifi cations for HTML5, but they are
not part of HTML 4.01 or XHTML. Pages written to those languages instead use the div
element to identify different page divisions. The syntax of the div element is
<div id=” id ”>
content
</div>
where id is a unique name assigned to the division and content is page content con-
tained within the division. While not required, the id attribute is useful to distinguish
one div element from another. This becomes particularly important if you apply different
styles to different page divisions.
Figure 1-12 shows how the same page layout marked up using structural elements
under HTML5 would be marked up in HTML 4.01 using the div element.
Figure 1-12
Structural elements in HTML5 and HTML 4.01
<header>
HTML5
<nav>
<section>
<aside>
<article>
<footer>
<div id="header">
HTML 4.01
<div id="nav">
<div id="section">
<div
id="aside">
<div id="article">
<div id="footer">
 
Search WWH ::




Custom Search