Even when work product canât stand up perfectly to the test of validation, the good intentions that underlie web standards remain relevant.
The primary goal of standards-friendliness is to allow iterative enhancement of work product, a significant aspect of which is forward compatibility. Standards-friendliness leads to syntactically correct markup in good source order that strictly enforces separation of structure from presentation, while minimizing the amount of time spent struggling with the minutiae of validation. While this practice concedes more to adverse circumstances than many web standards advocates feel is appropriateâsince after all, the project sponsor is the one who signs the paychecksâit still yields many benefits.
What do you get in return for the extra effort of a standards-friendly approach?
- Standards-friendly deliverables follow the Pareto (80/20) Rule, creating optimal benefit for the amount of time invested
The alternatives are unmaintainable assets, lack of scalability, and inflexibility. Such outcomes increase delivery times over the long term, since thereâs little in standards-ignorant work product on which to base modular assets.
- Accessible assets become much easier to create
When the source order of content is easily human-readable and developers use appropriate elementsâespecially lists, in the case of navigation functionalityâthe result presents few if any challenges for users of assistive technology.
- Users of alternative media also benefit from these accessibility improvements
Standards-friendly development offers the best opportunities to apply separate presentation layers to content on a per-media (e.g., screen, print, mobile) basis without being forced to create multiple instances of the same content, saving huge amounts of time and other resources.
- Data becomes more portable
When datastores are designed in the spirit of standards-friendliness, their contents can be transformed for use in other information systems, perhaps even systems that arenât web-based. Microformats advocates are especially ebullient about this benefit.
Following some basic rules of standards-friendly development can simplify creating and developing your sites in the long run:
Avoid presentation-oriented markup (especially inline
style
attributes) at all reasonable cost.Keep the source order of page content easily human-readable at all times.
Overbuild markup relating to overall document structure, but otherwise keep markup to the minimum required by the circumstances.
Relegate the use of table markup to data presentation only.
Ensure that all elements are properly closed, nested, populated, and supplied with required attributes; relegate all other validity concerns to a lower priority.
If possible, assign a distinctive
id
orclass
(or even one of each) to eachbody
element within a siteâs scope, to account for edge cases.Give all
id
s andclass
es names that are driven by context, rather than presentation. If you find yourself unable to follow this rule, youâre probably breaking Rule #1; if youâre able to follow it, youâre probably doing a good job of following Rules #2 and #3.Always use lists and headings where called for, even though it can be challenging to put the latter inside the former.
Relegate all images intended to provide design accents to the CSS
background-image
property.Draft separate stylesheets for Internet Explorer, limited to the scope of addressing layout bugs.
Like all rules, these have their exceptionsâand because it de-emphasizes the value of completely valid markup, Rule #5 breaks a few broader rules itself.
The guiding principle of these practices is not perfection but practicality: itâs often impossible to maintain perfect control over the entirety of a complex site, once poor third-party content and other flaws are taken into account.
Get HTML & CSS: The Good Parts now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.