Re: css hack for IE: is using the * acceptable

Toby Inkster wrote:
> windandwaves wrote:
>> Someone taught me that using the following is like an IE hack:
>> div#mydiv {padding: 10px; * padding: 12px;}
> I've never seen this, and don't know whether it works, but it's
> invalid. Better to do something like:
> DIV#mydiv
> { padding: 10px; }
> { padding: 12px; }
> which works and is valid.

It works fine. Your example I think works the other way. It works in all
browsers but IE

What I do is that I work out using php what browser it is and then serve a
different stylesheet.

However, I noticed that the asterix works fine. Just try it. It is
invalid, but that is the exact reason you do it. So that firefox, etc... do
not go for the padding 12px, while IE ignores the * and applies padding


- Nicolaas


Relevant Pages

  • Re: IE 6.0 / Firefox 1.07 and CSS positioning differences
    ... so that you make sure you trigger all modern/web standards compliant browsers into standards compliant rendering mode. ... border-color: black; border-style: solid; border-width: 1px; /* left: 10px; top: 10px; background-color: rgb; padding: 15px; padding-top: 5px; padding-bottom: 5px; font-weight: bold; font-size: 10pt; */} /* .menu_item ...
  • Re: Style first list item differently
    ... But please note that whenever you set left padding for a li element, you should also set left margin for it, too, and also left padding and margin for the enclosing element, ul or ol. ... The reason is that different browsers have different defaults for these properties for these elements, so that they use different methods to reserve space for the list markers. ...
  • Re: Lost ability to center tables vertically
    ... >> In standards mode, browsers are required to ignore invalid attributes, ... set html and body and table to 100% height through CSS. ... Sonhos vem. ...
  • dynamic combo boxes widths
    ... width of a dynamically produced drop down box, and some browsers having ... solutions involve manually refreshing the browser window and/or padding ... describes a way of padding the entries ... I'm asking because the information I'm reading may be outdated. ...
  • HTML vs. XHTML (was: tweet and pin button attributes failing validation)
    ... happened after the futile XHTML exercise (where browsers, AIUI, were ... writers got together and codified the ways they recover from crap HTML, ... thus in effect rendering invalid HTML, ...