Content Model Changes in HTML5

Album Cover: The Future

"Love's the only engine of survival."
Leonard Cohen / The Future

Posted on June 20, 2007 12:27 AM in Web Development
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

I was perusing through HTML5 differences from HTML4 tonight after seeing a link in Simon Willison's feed. The Content Model Changes section caught my eye:

HTML5 has defined stricter content models for elements such as div and li. These elements can now contain either "block level" or "inline level" content, but not both. This change makes HTML consistent in classifying elements according to whether they are used for structuring the page ("block level") or assigning semantics to text within the structure ("inline level").

Whenever I'm developing websites, I get this dirty feeling when I do something like the following:

<div id="footer">
 Copyright 2007...
</div>

For whatever reason, it's always seemed strange to me to put bare content in a div without what the above paragraph refers to as "block level" content, such as a p tag around it.

I think I'd feel even dirtier if I did something like what they show in their example:

<div>
 <em>...</em>
 <p>...</p>
</div>

It's kind of nice to see that the HTML5 spec will be stricter about the content model in these scenarios. I don't think I'll really be affected, though, simply because the dirty feeling leads me to using content enclosed in the p tag exclusively when adding content to divs.

Comments

No one has added any comments.

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.