HTML and CSS Reference
In-Depth Information
VALIDATING
HTML5
As you know, it is always a good idea to validate your finished HTML5 structure
before going further in your work to catch any DOM errors and the like that may
cause problems when you apply script and style to your content.
Henri Sivonen has created an experimental but perfectly usable HTML5
(+ WAI ARIA + SVG 1.1 + MathML 2.0) validator, which you can use to validate
your HTML5 documents regardless of the markup style used. You can find this
validator at http://html5.validator.nu. Unfortunately, it doesn't pick up on specific
syntax styles—for example, the XHTML style I recommend in this topic. It won't
pick up on missing attribute quotes, attribute values, or closing slashes because
that's all valid in HTML5!
To m i t i gat e t h i s p ro b l e m , I re co m m e n d t h at yo u a d d a n e x t ra s t e p t To yo u r va l i d a -
tion for now until available validators catch up. Visit the HTML Lint site a thttp://
lint.brihten.com ( Figure 2.1 ) to check your markup against several style options.
To c h e c k a ga i in s t t h e s t y l e I re co m m e in d i in t h i s b To To k , c h e c k t h e fo l l To w i in g To p t i To in s :
FIGURE 2.1 The HTML5
Va l i d at o r a n d H TM L L i nt .
Never omit closing tags. All nonempty elements must have a closing tag
(but empty elements don't need the trailing slash).
Lowercase tags. All tags should be lowercase.
Quote attributes. All attribute values should be in quotes.
Lowercase attributes. All attributes and their values should be lowercase.
Simple booleans. Minimised attributes are allowed (those with a value the
same as the attribute name can be shortened to just the name: I showed the
example required instead of required=”required” earlier).
 
 
 
Search WWH ::




Custom Search