HTML and CSS Reference
Figure 15-7 The Cool Shoes & Socks web page viewed in Internet Explorer 7.
1. In index.html, below the <link> reference to css/styles.css , add the following:
<!--[if lt IE 8]><link rel=”stylesheet” href=”css/styles-ie7.css”
2. Save index.html.
This code adds a stylesheet to the page that is to be applied only when a specific condition is met. The condi-
tion if lt IE 8 means “if less than Internet Explorer 8.” So, when the Cool Shoes & Socks page is
viewed in any version of Internet Explorer below version 8, the styles-ie7.css stylesheet is applied.
Following are a few examples of conditional comments you might like to use:
• if IE —If any version of Internet Explorer
• if IE 6 —If the browser is specifically Internet Explorer version 6
• if gt IE 8 —If the browser is greater than version 8 of Internet Explorer
• if gte IE 8 —If the browser is greater than or equal to version 8 of Internet Explorer
• if lt IE 9 —If the browser is less than version 9 of Internet Explorer