When I try to design sites with valid XHTML/CSS I often mull over this as I'm trying to find the best way to arrange my HTML tags. For lack of a better term I call it HTML structure patterns, borrowing a concept from the software world's idea of design patterns, where successful ways of doing things are documented, published and repeated across the community.
A definition of an HTML structure pattern would be: 'A way of arranging HTML elements to allow the clearest abstract representation of the content while maximizing accessibility, repurposability, and styleability with CSS.' I'd also clarify that this goes beyond simple validation and gets into how markup elements are combined and arranged. I'd be curious to see what kind of structure patterns are used by folks here on Tek Tips, and why those patterns have been successful for them. They can be as specific or as general as you want, but shouldn't be no-brainers or universally known. Hopefully we can all learn something. I'll start by listing a couple I'm familiar with:
BODY TAG CLASSES AND IDS:
By doing this I have fine-grained control over the page style and can selectively apply layout styles at the page level rather than the global level, plus the markup is natural and readable. For example the class "twosects" might trigger a multi-column layout in my CSS. Perhaps I want links on pages with class "article" to not have underlines for better readability. Perhaps I want a fish-scale background on only the fishing tutorial page:
An example is
SUBELEMENTS IN LINK TAGS:
From an accessibility and SEO point of view, having more descriptive text in a link is a good thing. From a design point of view it can take up too much space. By using subelements and some creative CSS you can get the best of both worlds, plus some nice effects like a roll-over description field. See this example:
Looking forward to seeing other ideas from designers on Tek Tips!
News and views of some obscure guy
A definition of an HTML structure pattern would be: 'A way of arranging HTML elements to allow the clearest abstract representation of the content while maximizing accessibility, repurposability, and styleability with CSS.' I'd also clarify that this goes beyond simple validation and gets into how markup elements are combined and arranged. I'd be curious to see what kind of structure patterns are used by folks here on Tek Tips, and why those patterns have been successful for them. They can be as specific or as general as you want, but shouldn't be no-brainers or universally known. Hopefully we can all learn something. I'll start by listing a couple I'm familiar with:
BODY TAG CLASSES AND IDS:
Code:
<body class="twosects article" id="fishingtutorial">
Code:
body.twosects div.primarycontent { width: 70%; }
body.twosects div.secondarycontent { width: 30%; position: absolute; top: 80px; right: 0px; }
body.article a { text-decoration: none; }
body#fishingtutorial { background-image: url(scales.jpg); }
SUBELEMENTS IN LINK TAGS:
Code:
<a href="...">Stock Quotes <span class="description">Today's hottest picks according to Bill</span></a>
Code:
a:link span.description { display: none; }
a:hover span.description { display: block; position: absolute; left: 0px; top: 0px; }
News and views of some obscure guy