HTML and CSS Reference
In-Depth Information
Class names based on conditional comments
An iteration of the previous conditional comments method would be to append class
names on the root element based on conditional comments, as shown in the follow-
ing code snippet:
<!--[if IE 8]>
<html class="no-js lt-ie9">
Then in your stylesheet, you can use it to set styles in IE8 and below as follows:
.lt-ie9 h1 { color: red }
You can read more about this solution at
stylesheets-vs-css-hacks-answer-neither/ .
This solution does not require separate stylesheets, but allows you to write readable
class names that indicate why that style rule exists in the stylesheet. This is the solu-
tion we have adopted in HTML5 Boilerplate, and recommend.
What is meta x-ua-compatible?
x-ua-compatible is a header that defines how Internet Explorer renders your
pages. It declares which mode Internet Explorer should use to render your page.
This is primarily targeted towards older websites that break in Internet Explorer 9 on-
wards because of better support for standards. It can be set in two ways.
Meta tag in your HTML page
In this case, we merely add a meta tag between the <head></head> tag in your
HTML pages as follows:
<meta http-equiv="X-UA-Compatible"
Search WWH ::

Custom Search