HTML and CSS Reference
In-Depth Information
<!-- [if lt IE 8]>
<link type=”stylesheet” src=”/css/ie_lessthan_8.css”>
<![endif] -->
The downside to adding style rules in this manner is that you create two
or three places where code for the same item resides, making it easy
to forget to maintain each set of rules. A comment in the main CSS file
designating where there is additional code can be a useful way to keep
track of things:
#block { /* see also: @ie_lessthan_8.css */
...
}
The upside to conditional comments is that you have much greater
control and confidence over what versions of IE will see your code than
hacks can provide.
IE and hasLayout
In versions 6 and 7, Internet Explorer has an internal method of distin-
guishing when an element in the page needs some special layout
features such as positioning or sizing. Based on the application of certain
styles, such as height or positioning, Internet Explorer places an element
into a bucket that gets extra layout handling or one that doesn't. This
internal flag is labeled hasLayout . The hasLayout flag was not meant
to be exposed to those of us building web sites, but the internal archi-
tecture that relies on this flag is also the source of a few common CSS
bugs. Figure 2.2 shows the indicator present on a <div> element in the
IE Developer Toolbar.
 
 
Search WWH ::




Custom Search