Page Layout & New Elements
HTML5
HTML5 is the next major version of HTML. It introduces
new elements that will make our pages more semantic. This will make it a lot easier for search engines and screenreaders to navigate our pages, and improve the web experience for everyone.
Before we begin marking up the page we should get the overall structure straight.
Basic Page Structure
This page is going to look at the new elements which specifically identify each of the following common constructs:
Header:
The page header shown at the
top of the page
and additional
smaller page headings. Importantly; it is not the same as the head element!
Nav:
A collection of links to other pages
Section:
A part or chapter in a book, a section in a chapter, or essentially anything that has its own heading in HTML5
Article:
An independent entry in a blog, magazine, compendium, and so forth
Aside:
The aside element contains anything outside the main flow of the page.
Footer:
The page footer where the fine print goes or the signature in an e-mail message
Take a look at the markup, then we'll go through a few things:
< !doctype html >
In HTML5, there is only one doctype. It is declared in the beginning of the page by
< !doctype html > . It simply tells the browser that it's dealing with an HTML-document.
To see one immportant style declaration for the new elements click
here. Now lets look at the new elements individually.
< header>
< h1>Page Layout & New Elements< /h1>
< /header>
The new header tag is wrapped around introductory elements, such as the page title or a logo. It could also contain a table of contents or a search form. Every header typically contains a heading tag from h1 to h6. In this case the header is used to introduce the whole page, but we'll use it multiple times to introduce sections of the pages, for example
here.
In the example to the left we use the header-tag to wrap around the introductory h1 element of the page. In addition to describing a whole document, the header-tag should also be used to describe individual sections, there are many examples on this page, for example, right at the bottom;
< header> < h3>Comments< /h3> < /header>
Return to the Top of the Page
< nav>
list item 1
list item 2
.....
< /nav>
The nav-tag is used to contain navigational elements, such as the main navigation on a site or more specialized navigation like next/previous-links.
It is marked up exactly like we would do it in HTML4 or XHTML, using an unordered list. The key is that this list is placed inside the nav-tags. So we no longer have to create a div and name in nav, it already exists.
To see how the new nav element is styles go
here.
Return to the Top of the Page
Comments
Dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut.
Click here to learn how you can now apply a Zebra effect to the comments without using JavaScript.
This is an ideal section to explain how you zebra stripe the comments using the new css3 styles.