HTML and CSS Reference
In-Depth Information
The previous example will render the p tag on all 8, 7, 6, and below versions of IE.
Conditional comments are perfect to target older versions of IE and this is what
HTML5 Boilerplate uses. There are two ways of using them. The first is to output a
separate stylesheet based on matching a conditional comment, as shown in the fol-
lowing code snippet:
<!--[if lt IE 9]>
<link rel="stylesheet" href="/css/legacy.css">
This will make IE8 and below use legacy.css and other browsers will ignore this
snippet of code.
The problem with a standalone stylesheet is that while you develop your styles
you have two different stylesheets to target, and occasionally IE-specific stylesheets
could be forgotten.
Some people provide only a very basic experience for IE8 and below, as shown in
the following code snippet:
<!--[if ! lte IE 6]><!-->
/* Stylesheets for browsers other than Internet
Explorer 6 */
<!--[if lte IE 6]>
<link rel="stylesheet"
files/ie6.1.1.css" media="screen, projection">
But HTML5 Boilerplate prefers a more readable and targeted approach that provides
the best possible styles to all browsers using class names, which we will look at next.
Search WWH ::

Custom Search