CSS font color in IE8

Associate
Joined
25 Jan 2009
Posts
1,398
Pretty simple here assigned some font colours in CSS like this:

red {
color: red;
}

green {
color: #549900;
}

orange {
color: #F9AF64;
}


Works perfectly fine in FF, chrome, safari and opera BUT suprise suprise it doesn't work in internet explorer

Any ideas :confused::confused:
 
in the CSS
Code:
.red {color: red;}

then in the HTML
Code:
<h1 class="red">red text</h1>
<p class="red">some more red text</p>

surprised <red></red> would be allowed in browsers xD
 
The thing is it works perfect in the other browsers but why not IE?

And I don't want to change the h1 or p class to red, 'red' is it's own class in the CSS which is only assigned to change text to red, why would it not be accepted, you can choose what ever name you like for the class right :confused:
 
TBH IE is correct as your original example shouldn't work at all. It's just wrong.

And I don't want to change the h1 or p class to red, 'red' is it's own class in the CSS which is only assigned to change text to red, why would it not be accepted, you can choose what ever name you like for the class right
That's true, however without the leading '.' you aren't specifying the name as a class - the CSS interpreter is looking for an element called <red />
 
I really don't understand how it's wrong *facepalm* I'm no expert either, for example the <body> tag is assigned some values in the CSS including colour and then in the main html it's <body> and at the end </body> and I've done the exact same thing just with a different name, so what's the problem with that :confused::confused:

The only reason for trying to do it this way is because when do a simple <font color #f00></font> within the HTML it again doesn't work in IE
 
Last edited:
in the CSS
Code:
.red {color: red;}

then in the HTML
Code:
<h1 class="red">red text</h1>
<p class="red">some more red text</p>

surprised <red></red> would be allowed in browsers xD

ok I did it like this one looking at this I was confused by the HTML part not realising it was an example :cool:

But I gave the line of code to my friend which had <h3> tags and he did it just as you had, then I *Facepalmed myself, thanks anyway! :D
 
Back
Top Bottom