Differentiating CSS for IE7 IE6 and firefox

if you put # before any css tag, only IE 7 and IE 6 will read that line.
if you put _ before any css tag, only IE 6 will read that line.

example:

width: 560px;     /* All other browsers */ 
#width: 558px;    /* IE 6 & 7 */
_width: 557px;    /* IE 6 */

just remember to keep this order.

Comments

css fonts

css Font examples , Properties , Attribute - - //
http://www.css-lessons.ucoz.com/font-css-examples.htm

W3 Validation

Hi Nima,
I am 25 year veteran DOS and Windows programmer and am just now learning XHTML/CSS to create a web site.

This method seems to work in these 3 major browsers and assume it will not kill any others.

When I submit it to the W3 CSS Validator it complains. A sample:
html {
font-size: 12px; /* Firefox+ */
#font-size: 75%; /* IE6, IE7 */
_font-size: 100%; /* IE6 only */
font-weight: normal;
}

W3C CSS Validator Results for file://localhost/TextArea
Sorry! We found the following errors
URI : file://localhost/TextArea
3 html Parse Error - .font-size: 75%;
6 Parse Error - : 100%; font-weight: normal; }

I also found a similar suggestion using a period instead of pound sign but it also fails.

Using the !important validates but doesn't give as much control.

Is this something we will have to live with?

Thanks
Tom
(:-{>

I ignore this validation errors!

Hi Tom.
Actually this trick, !important, period and ... are not valid structures for CSS.
Since I rarely need to use this trick in my style sheets, I ignore any validation error about that.

Regards.
Nima