Jump to content

Something wrong... W3C CSS Validator issues


Dirx
 Share

Recommended Posts

First of, I'm a CSS Newbie...So anyway, I've got a CSS, and I've ran it through W3C's CSS Vaildator, and got a heap of warnings (have no clue what those warnings mean) something about not having a Colour...(I did put colour as Color) and so i went to w3schools, to see whats going and to see if my css is more or less following the examples...it is, so i copy/pasted

p{ background-color: #00ff00}

In put that in to the W3C's CSS Vaildator, and got the same warnings....So, err....Help? I have no clue whats this means... Or is it something that i should ignore?And again, Please be Kind, I am a Newbie...at CSS i mean.

Link to comment
Share on other sites

Do you use that color for other things on the page? It gives warnings if it thinks text will end up on a background the same colour...Otherwise, I usep {background: #00ff00;}See if that gives the same feedback.Also, be aware that a warning from the validator isn't necessarily an error. You can still have warnings and valid code.

Link to comment
Share on other sites

Line : 2 (Level : 1) You have no color with your background-color : p
from inputting
p {background: #00ff00;}

So if i have a warning, the coding is still valid, just not playing well with the validator?I used another CSS Validator, and got another Warning, had something with the colour, not being the colour and should have something else...I have noe clue...I'll try and find the url later...Thanks for the Help BTW.

Link to comment
Share on other sites

I've had exactly the same before, only then it was because of the colornames that I used, instead of the hexvalues. The names are not valid according to the validator...Else, I don't know what is wrong :) Your CSS seems totally and completely valid :)

Link to comment
Share on other sites

Well... Actually I checked the code that F-Man suggested and it turned out as a valid CSS. I now realize why does the validator requres such. It's because it presumes you define a new background color that would need a new color for the text inside in order to look good. Or at least that's what I think...Anyway. The code F-Man proveided is the one you need Dirx :) .

Link to comment
Share on other sites

If you say color is 'black', and put in the hex of white in the background color it will be sort of negative standard page with letters :) White in black. Or didn't I understood you? :) This would be valid though..I mean, both hex and colorname aren't possible to give for both same property, so it is or the text color (color:...) or the background (background-color:...).

Link to comment
Share on other sites

  • 1 year later...
Guest FirefoxRocks

Yes, a background-color set needs a color set as well because of accessibility purposes. It ensures that both colours contrast each other a sufficient amount so that you can see them easily. And yes, using custom styles in the browser can override settings, which may or may not be a good thing.

Link to comment
Share on other sites

  • 2 weeks later...

Is there any "transparent" color that you could set for the background to "trick" the validator?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...