views:

279

answers:

2

How well do the new layout tags in HTML5 degrade? What are the hazards in using them? (I'm not talking about <video>--I've seen specific fallback code for it).

Specifically, in the case of something like

<html>
<head></head>
<body>
<header>
<h1>Talking Dogs</h1>
<b><p>Humans aren't the only talkers!</p></b>
</header>
<article>
<p>Ever encountered a talking dog? I have.</p>
<p>It all happened one day as I was walking down the street...</p>
</article>
<footer>
© 2009 Woofer Dog Corporation
</footer>
</body>
</html>

Would using <header>, <article>, or <footer> cause any browser problems? Do they degrade to <div> in unsupporting browsers automatically? Or if I include them, should I only include them for semantic meaning, and not for CSS styling or DOM scripting?

+6  A: 

As long as you use html5shiv to handle IE, it will work fine.

The browser will treat all unknown tags (including HTML5 tags) as normal inline elements.
You should include the following CSS rule:

article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
SLaks
A: 

For presentation you'll use CSS anyhow, so doesn't really matter if browser understands the tag itself.

vartec
so, if I style footer { display:block; background-color: pink;}it'll work across browsers, even ones that don't really know what footer is?
emailq
"not knowing the tag" basically means "not knowing how to display tag by default", if you override that with custom CSS, they browser will know how to display. Note, that CSS works even with XML, where you can have totally custom tags.
vartec
Yes, it will work, as long as you add http://html5shiv.googlecode.com/svn/trunk/html5.js
SLaks