Subject: RE: Divs, CSS, and Positioning
If you don’t cascade divs within divs, you are probably missing structural information in the document. Adding divs for layout purposes only is as evil as the misuse of tables, but failing to add divs to mark off logical divisions (and subdivisions) within the document is not really semantic markup either, is it?
Eventually, of course, you will reach a point where the “classic” elements – lists, headings, paragraphs, etc. – are all you need, and adding divs to specify that headings are headings, say, is being needlessly and unnecessarily repetitive and redundant. Above that threshold, though, you can usually find “chunks” of the page that make up a logical grouping (an article in a newsletter, say, or a posting on a blog or forum), and if there are similar chunks on the page, they should be grouped together as another “chunk” that defines a type of content (say “news”, “sports” and “business”). None of those should be confused with the banner information or the navigation elements, so there needs to be a sementic barrier between chrome, menus and content.
Guess what – you are now three deep in nested divs without doing anything at all for the sake of layout. If you view the page in a text-only browser, everything degrades properly and the page still makes sense. More than that, though, a parsing engine can tell what’s what and where’s where – where the “meat” is, which part of the “meat” is news and which is sports, and where each story starts and ends. And it’s that relatively dumb parsing engine that we’re shooting for – if a hypothetical, blindingly stupid, machine can make sense of the structure while keeping the page human-readable without CSS, then we’ve achieved semantic markup.
(A side note: the “engine” we are designing for is strictly hypothetical. That’s because there is no standards-based method for defining content chunks in HTML or XHTML.
means nothing to a real-world machine unless it has been given the rules for your site/page. Now, if you are consistent with your tagging, you COULD give a set of rules to another party and allow them to parse the data from your page. Or you could add an RSS feed to your application, go back to tables and forget the whole thing…)