
Originally Posted by
kgun
Personally I have not started to use HTML5, so what is the correct DOC type etc? Do I need to go to W3C or Alistapart? Tell me how it is done with HTML5 and XHTML.
Jump into your template folder and swap out the existing DOCTYPE with this one:
HTML Code:
<!DOCTYPE html>
That's it. Your document (assuming it is valid HTML or XHTML) is now valid HTML5. Now you can jump right in.
It might not be valid markup, but newer browsers support the new elements, many regardless of DOCTYPE. The HTML5 doctype just automatically throws the rendering engine into standards mode.
Being a big fan of semantics, this is the perfect specification for you, @kgun. It's all about semantics. Structure no longer needs to be confined to just breaking down the headings. The entire tag library is geared to exposing the document structure right down to the minutest detail.
Take for example <DIV>. We know it's a block level element, and have used it for all these years to wrap everything from soup to nuts. Now it is relegated to the outer wrapper. The new element, <section> is taking over, and making more sense, just being there. Add to this, <article> and things really begin taking on order and meaning.
We used to hang our H's out there, hoping they would act as the glue that holds our articles together. Now we can wrap headings in an <hgroup> element so they stand right out. Add to this the new <header> element, and we will never again have to use, <div id="header">.
HTML Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>This is an HTML5 document</title>
</head>
<body>
<div id="wrapper">
<header>
<nav role="navigation">
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<hgroup>
<h1>This is an HTML5 Document</h1>
<h2>Markup that means something</h2>
</hgroup>
</header>
<section role="main">
<nav role="navigation">
<ul>
<li><a href="#cats">Cats</a></li>
<li><a href="#dogs">Dogs</a></li>
</ul>
</nav>
<section>
<article id="cats">
<hgroup>
<h2>For the love of cats</h2>
<h3>Curl up with one today!</h3>
</hgroup>
<p>Yadda yadda yadda, blah blah blah, nice kitty!</p>
<p>Care of long hair cats is a year long job that must be done regularly. Fig. 1. illustrates the method used to remove hairballs.</p>
<figure>
<img src="hairballs.png" alt="removing hairballs from long hair cat" width="300" height="240">
<figcaption>Fig. 1. Removing hairballs from a long hair cat</figcaption>
</figure>
</article>
<article id="dogs">
<hgroup>
<h2>For the love of dogs</h2>
<h3>Trade in your PC for one today!</h3>
</hgroup>
<p>Yadda yadda yadda, blah blah blah, good dog!</p>
<aside>
<p>Take your PC for a walk today. Your dog will love you for it.</p>
</aside>
</article>
</section>
</section>
<aside>
<ul>
<li><a href="#">Blogroll</a></li>
<li><a href="#">My Site</a></li>
</ul>
</aside>
<footer>
<ul>
<li><a href="#">Privacy</a></li>
<li><a href="#">Site Map</a></li>
</ul>
</footer>
</div>
</body>
</html>