...

View Full Version : The validator takes exception to some of the following css. NOW SORTED.



effpeetee
10-23-2007, 02:38 PM
The validator takes exception to some of the following css.
Generally about colour info missing.

I did not write this code, but it has worked faultlessly.

Any pointers as to what would make w3 validator happy?

Frank



#content {
float: left;
font: 10px Arial, Helvetica, sans-serif;
text-decoration: none;
width: 20%;
margin-top: 50px;
margin-left: 26px;
padding: 5px;
text-align: left;
}

#links {
clear: left;
color: white;
font: 10px Arial, Helvetica, sans-serif;
line-height: 1.2;
}

#links ul {
margin: 0;
padding-left: 3px;
color: white;
list-style: none;
}

#links ul li {
padding-left: 20px;
}

#links ul a {
color: white;
font-size: 1.3em;
font-weight: normal;
text-decoration: none;
}

#links ul a:hover {
text-decoration: underline;
}

#footer {}

h1 {
color: #f00;
text-align: center;
}

#cap {
font-size: 50px;
color: #FF0;
font-weight: bold;
float: left;
height: 34px;
line-height: 24px;
margin-top: 2px;
margin-right: 1px;
}

* html #cap {
margin-right: -2px;
margin-top: 3px;
}

#valids {
clear: both;
margin: auto;
width: 176px;
padding: 2px;
}

jlhaslip
10-23-2007, 03:10 PM
It likes that you set a background colour when you set a colour, but this snippet validates for me as a direct entry

dcostalis
10-23-2007, 03:22 PM
It likes that you set a background colour when you set a colour, but this snippet validates for me as a direct entry

Depending on the doctype, it will validate without setting a background color. I know that Strict doctypes always need both.

jlhaslip
10-23-2007, 03:59 PM
yes, and the snippet has no Doctype, so I assume the Original poster is carrying a strict Doctype, hence the reply.

Jutlander
10-23-2007, 04:34 PM
Depending on the doctype, it will validate without setting a background color. I know that Strict doctypes always need both.
My blog is valid HTML 4.01 Strict and so is the CSS. I have set a color on several occasions without setting a background color and it doesn't complain at all.

effpeetee
10-23-2007, 04:51 PM
It's very weird.

I checked it on the IE toolbar, but just now I have checked it direct and it is OK.

Both times it used the W3 validator.

I have had this problem in the past when checking with the IE toolbar has given a different result. It will need to be watched.

Frank

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

felgall
10-23-2007, 09:56 PM
When you set a color without a background-color (or vice versa) you are relying on no one setting the other to the same color and thus making the content invisible. Remember that you are not the only one who can define styles for your page, all your visitors can too.

effpeetee
10-23-2007, 10:49 PM
When you set a color without a background-color (or vice versa) you are relying on no one setting the other to the same color and thus making the content invisible. Remember that you are not the only one who can define styles for your page, all your visitors can too.
I can see the sense of setting the color, but can't they alter it anyway, even if I have set the color?

If I don't set the color, does it inherit it from the parent, or what happens?

I still have a way to go to understanding the cascade. ( as well as many other things)

Frank

harbingerOTV
10-24-2007, 01:57 AM
The code will still validate. It has no errors just warnings. Warnings to make invalid code. What the background color for your color is there for, is to make sure there is enough contrast between colors. Teh biggest one is, eg. if your using dark text make the background color of the highest parent (if possible) a light color and visa versa. Not only will this make sure all the text is legible with images turned off (if using a background image) but will make sure that when text is highlighted, it's a high contrast highlight.

for instance if you make a page with a black background color and black text, and you use only a background image with no color for the background of the content area, when you highlight it, it will default to black on white (unless the user has changed the default). the result is that while you are highlighting the text, you can't tell you are.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum