54
arTicLe
442
HTML5 LAYOUT
442
HTML5 LAYOUT
Older browsers that do not
know the new HTML5 elements
will automatically treat them as
inline elements. Therefore, to
help older browsers, you should
include the line of CSS on the
left which states which new
elements should be rendered as
block-level elements.
Also, IE9 was the first version of
Internet Explorer to allow CSS
rules to be associated with these
new HTML5 layout elements.
In order to style these elements
using earlier versions of IE, you
need to use a simple JavaScript
known as the HTML5 shiv or
HTML5 shim.
You do not need to understand
JavaScript to use it. You can
just link to a copy that Google
hosts on its servers. It should
be placed inside a conditional
comment which checks if the
browser version is less than
(hence the
lt
) IE9.
Unfortunately, this workaround
does require that anyone using
IE8 or earlier versions of IE
has JavaScript enabled in their
browser. If they do not have
JavaScript enabled then they will
not be able to see the content of
these HTML5 elements.
header, section, footer, aside, nav, article, figure
{
display: block;}
chapter-17/example.html
CSS
HeLping oLder
Browsers undersTand
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/
trunk/html5.js"></script>
<![endif]-->
chapter-17/example.html
HTML