HTML and CSS Reference
In-Depth Information
This example, at least currently, conforms to the HTML5 specification:
Do not interpret the previous example to mean that HTML5 allows a markup free-for-all.
Understand that these “mistakes” are actually allowed under traditional HTML and thus
are allowed under HTML5. To ensure that you conform to the HTML5 specification, you
should be concerned primarily about the following:
Make sure to nest elements, not cross them; so
<b><i> is in error as tags cross </b></i>
whereas
<b><i> is not since tags nest</ i></b> .
Quote attribute values when they are not ordinal values, particularly if they contain
special characters, particularly spaces; so
<p id=p1> Fine with no quotes </p>
because it is a simple attribute value, whereas
<p title=trouble here with no quotes> Not ok without quotes </p>
is clearly messed up.
Understand and follow the content model. Just because one browser may let you
use a list item anywhere you like,
<li> I should be in a list! </li>
it isn't correct. Elements must respect their content model, so the example should
read instead as
<ul><li> All is well I am in a list! </li></ul>
because it follows HTML5's content model.
Search WWH ::




Custom Search