HTML and CSS Reference
In-Depth Information
IE8 and below require the <body> element before they will apply
CSS to style new HTML5 elements, so it makes sense to use
this element, too.
So, in the interest of maintainability, we'll add those optional
elements to make what's probably the minimum maintainable
HTML5 page:
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Interesting blog</title>
</head>
<body>
<p>Today I drank coffee for breakfast. 14 hours later,
¬ I went to bed.</p>
</body>
</html>
Does validation matter anymore?
Given that we have such forgiving syntax, we can omit implied tags like <html> , <head> , and <body> ,
and—most importantly—because HTML5 defines a consistent DOM for any bad markup, you might be
asking yourself if validation actually matters anymore. We've asked ourselves the same question.
Our opinion is that it's as important as it's ever been as a quality assurance tool. But it's only ever been
a tool, a means to an end—not a goal in itself.
The goal is semantic markup: ensuring that the elements you choose define the meaning of your content
as closely as possible, and don't describe presentation. It's possible to have a perfectly valid page made
of nothing but display tables, divs, and spans, which is of no semantic use to anyone, Conversely, a single
unencoded ampersand can make an excellently structured, semantically rich web page invalid, but it's still
a semantic page.
When we lead development teams, we make passing validation a necessary step before any code review,
let alone before making code live. It's a great way to ensure that your code really does what you want.
After all, browsers may make a consistent DOM from bad markup but it might not be the DOM you want.
Also, HTML5 parsers aren't yet everywhere, so ensuring valid pages is absolutely what you should aim for
to ensure predictable CSS and JavaScript behaviours.
We recommend using http://validator.w3.org/ or http://html5.validator.nu . We expect that there will be
further developments in validators, such as options to enforce coding choices—so you can choose to
be warned for not using XHTML syntax, for example, even though that's not required by the spec. One
such tool that looks pretty good is http://lint.brihten.com , although we can't verify whether the
validation routines it uses are up-to-date.
 
Search WWH ::




Custom Search