![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I trying to validate myy CSS using http://jigsaw.w3.org/css-validator/. I get back some errors, but I don't understand them. I will leave you with the errors and then the CSS. Thanks in advance. Line : 24 (Level : 1) You have no background-color with your color : div.navigationItem a Line : 29 (Level : 1) You have no color with your background-color : div.navigationItem a:link |
|
div.navigationItem a { display: block; font-weight: bold; text-decoration: none; text-align: right; letter-spacing: 1px; margin: 0px; color: blue; /* THIS IS LINE 24 */ --> background: white; border-top: 1px solid black; } div.navigationItem a:link{ background: white; /* THIS IS LINE 29 */ --> color: black; text-decoration: none; } |
#3
| |||
| |||
|
|
Hi, I trying to validate myy CSS using http://jigsaw.w3.org/css-validator/. I get back some errors, but I don't understand them. I will leave you with the errors and then the CSS. Thanks in advance. Line : 24 (Level : 1) You have no background-color with your color : div.navigationItem a Line : 29 (Level : 1) You have no color with your background-color : div.navigationItem a:link I believe those are only warnings. |
#4
| |||
| |||
|
|
eomer wrote: Hi, I trying to validate myy CSS using http://jigsaw.w3.org/css-validator/. I get back some errors, but I don't understand them. I will leave you with the errors and then the CSS. Thanks in advance. Line : 24 (Level : 1) You have no background-color with your color : div.navigationItem a Line : 29 (Level : 1) You have no color with your background-color : div.navigationItem a:link These are warning, not errors. The reason is a visitor may have set a text color the same as your background, and would not be able to see your text. div.navigationItem a { display: block; font-weight: bold; text-decoration: none; text-align: right; letter-spacing: 1px; margin: 0px; color: blue; /* THIS IS LINE 24 */ --> background: white; border-top: 1px solid black; } div.navigationItem a:link{ background: white; /* THIS IS LINE 29 */ --> color: black; text-decoration: none; } The rule is: if you set one, set the other as well. |
#5
| |||
| |||
|
|
In article <1piv67uh0nev2$.1eh1vecgacg97.dlg (AT) 40tude (DOT) net>, Beauregard T. Shagnasty <a.nony.mous (AT) example (DOT) invalid> wrote: eomer wrote: Hi, I trying to validate myy CSS using http://jigsaw.w3.org/css-validator/. I get back some errors, but I don't understand them. I will leave you with the errors and then the CSS. Thanks in advance. Line : 24 (Level : 1) You have no background-color with your color : div.navigationItem a Line : 29 (Level : 1) You have no color with your background-color : div.navigationItem a:link These are warning, not errors. The reason is a visitor may have set a text color the same as your background, and would not be able to see your text. div.navigationItem a { display: block; font-weight: bold; text-decoration: none; text-align: right; letter-spacing: 1px; margin: 0px; color: blue; /* THIS IS LINE 24 */ --> background: white; border-top: 1px solid black; } div.navigationItem a:link{ background: white; /* THIS IS LINE 29 */ --> color: black; text-decoration: none; } The rule is: if you set one, set the other as well. I don't understand the 2nd warning either: It would seem he has specified both a color (line 24) and a background color (line 29), right? |
#6
| |||
| |||
|
|
Rob Stampfli wrote: .... div.navigationItem a { display: block; font-weight: bold; text-decoration: none; text-align: right; letter-spacing: 1px; margin: 0px; color: blue; /* THIS IS LINE 24 */ border-top: 1px solid black; } div.navigationItem a:link{ background: white; /* THIS IS LINE 29 */ text-decoration: none; } The rule is: if you set one, set the other as well. I don't understand the 2nd warning either: It would seem he has specified both a color (line 24) and a background color (line 29), right? No. In his example, a color is specified for "div.navigationItem a" and a background color is specified for "div.navigationItem a:link". You need to assign both for each selector. |
#7
| |||
| |||
|
|
But, shouldn't the color and/or background-color be inherited if one is not explicitly given? |
|
In other words, if you've set the background-color in <body>, why should you need to restate it explicitly if you later set the color in, say, a <span>? Why should the validator issue a warning in such a case? |
#8
| |||
| |||
|
| Rob Stampfli <restamp (AT) hotmail (DOT) com> wrote: But, shouldn't the color and/or background-color be inherited if one is not explicitly given? Yes. But from what is it going to be inherited? In other words, if you've set the background-color in <body>, why should you need to restate it explicitly if you later set the color in, say, a <span>? Why should the validator issue a warning in such a case? The C in CSS is for "Cascading". Rules from other style sheets can cascade with your rules. As an example, you might specify color and background for BODY elements, but a user style sheet might specify color and background for P elements. If you specify only color for SPAN elements, which background will they be shown against? |
#9
| |||
| |||
|
|
So why pick on "background-color"? |
#10
| |||
| |||
|
|
Granted. But, a user style sheet could just as easily specify a background image for P elements, yet I don't see the validator complaining about the lack of an explicit "background-image:" attribute to undo this on every element where a "color" is specified. So why pick on "background-color"? |
![]() |
| Thread Tools | |
| Display Modes | |
| |