Click to See Complete Forum and Search --> : [RESOLVED] Simple question I think...
bsstweb
09-26-2007, 10:23 AM
This will probably make me look rather dumb, but I want to understand the concept completely since I'm seeing this pop up in code more often.
What is the difference between a tag like this:
#titlepic
and a tag like this:
*html#titlepic
Another example was with the <ul> command
#green ul {
margin: 0 0 0 3px;
padding-left: 0;
display: inline;
width:800px;
float:left;
list-style-type: none;
list-style-position: inside;
}
* html #green ul{
margin: 0px;
padding-left:3px;
}
both commands control the same ul - so what is each one doing differently?
thanks in advance!
Centauri
09-26-2007, 12:07 PM
* html whatever (note the spaces) is a hack to target IE6 and below. The syntax means "an element contained within the html element which is contained within any other element". IE6 and below are the only browsers that thinks the html is wrapped within something else, so they accept the styles whilst all other browsers simply ignore it. Very handy as IE6 has the most problems with css out of any of the current crop of browsers, and this allows a simple way of giving IE6 something different to correct a bug.
kiwibrit
09-26-2007, 02:47 PM
Beware of * html (http://www.positioniseverything.net/articles/poll/star-html.php). Better to use a conditional statement to call up a style sheet, IMV.
Centauri
09-26-2007, 07:07 PM
That article was written before IE7 came out, when the full effect of such hacks was relatively unknown. As it has turned out, IE7 behaves a little better than initially thought, and specific styles directed only to it are rare. Unless there need to be a lot of separate rules for IE6 (in which case maybe the structure needs to be looked at), I don't see the point of a separate sheet. When the day comes that we can drop support for IE6, then removing a few * html hacks from stylesheets would be easier than removing conditional comment links from all existing pages.
bsstweb
09-27-2007, 08:47 AM
Thank you for explaining that - that makes sense. Good ole IE.
Cheers!