Forum Moderators: not2easy

Message Too Old, No Replies

css validator warnings

what's everyone's opinion on these?

         

HelenDev

1:31 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know this has been discussed briefly before here [webmasterworld.com] and elsewhere on the web, but I was wondering what everyone here thought about these - whether it's worth making fixes for these warnings or not?

My first instinct was to make whatever fixes are necessary, but as other people have pointed out, for a large site, the code bloat in the stylesheet would be a nightmare - we've spent a long time trying to cut down the size of the stylesheet, not increase it!

On more specific points such as the need to specify a background color if you've specified a foreground color - why doesn't everything just inherit the background color of the body if you've specified one?

Other warnings I've noticed are things like 'Same colors for background-color and border-left-color' - why would this even matter?

Other warnings also include stuff I don't understand, such as:
Redefinition of border-top-style
This property applies to block-level elements.

Can anyone shed any light on these or offer general thoughts or advice? What would be the 'best practice' advice for this?

Robin_reala

1:55 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



why doesn't everything just inherit the background color of the body if you've specified one?

Background colours don't inherit; they default to transparent. Now say someone prefers to read white text on a black background and sets up a user stylesheet to apply those rules to <body>. If you've defined your <p>s to have black text, but forgotten to define a background colour of white, then they'll see the black text you've defined ontop of the black background they've defined, and won't be able to read anything.

At the end of the day they're warnings, not errors. It's up to you to evaluate them and decide whether they're worth fixing.

HelenDev

2:08 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's up to you to evaluate them and decide whether they're worth fixing

This is what I have a problem with. If what you say about colors/background colors is true (and I'm sure it is ;)) then they are all worth fixing. However, increasing our stylesheet to an unwieldy size would adversly affect usability for everyone wouldn't it?

What if background colors did inherit, rather than default to transparent? Would this cause any problems with stylesheets? Or would it save lots of problems (warnings) and code bloat? Just a theoretical question mind ;)

jessejump

2:32 pm on Feb 28, 2006 (gmt 0)

10+ Year Member



>>>>> they'll see the black text you've defined on top of the black background they've defined,

I thought they defined text as white.

Robin_reala

4:38 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But if they only defined it on the <body>, and you defined it on your <p>s then as I understand it your <p>s will override their <body> due to inheritance.

jessejump

4:56 pm on Feb 28, 2006 (gmt 0)

10+ Year Member



You're right, but I've never understood the warning.
Why would a user set a color just for his text and not set an appropriate background also for each element?

JAB Creations

4:59 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The CSS validator has some issues due to standards being too relaxed...

[w3.org...]

You have no background-color with your color

This simply is invalid as "transparent" is a valid W3C value. It it's specified then the webmaster has consciously decided that value thus negating the need for a color. Not sure who these people are who are arguing against transparent but it's a valid W3C spec and the validator is either right or wrong and in this case it's wrong.

Just like on Mozilla's Bugzilla you're going to find people who don't know what they are talking about who don't want to fix things.

John

pageoneresults

5:02 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



We had a lengthy discussion on this one not long ago...

[webmasterworld.com...]

All new style sheets that I create now have color and background colors assigned where applicable so that I can validate without any warnings. It's a tedious process and requires some different methods of thinking and design but, I just don't like seeing those warnings. ;)

Robin_reala

5:36 pm on Feb 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The trouble with background-color: transparent is that although it removes the warnings it doesn't fix the reason why you're being warned in the first place. If W3 are going to warn about this problem then they should at least fix the validator to still error if the background is transparent.

HelenDev

9:29 am on Mar 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for pointing me in the direction of that one, pageoneresults :)

The conclusion I'm reaching at the moment is that it's a good idea to code all your color pairs where possible, but that the other warnings can generally safely be ignored without compromising accessibility?

Robin_reala

12:12 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The same conclusion I've reached.