Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating CSS

Status
Not open for further replies.
Oct 11, 2006
300
US
Hi,

I am trying to validate my CSS page using the W3 validator service.

On running, I noticed several errors:

What do I do about the 1 st error?
Code:
Line: 8 
Parse error - Unrecognized : <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-color:#5a5b5e; font-size: 12px; }
In this line, it says that it is not a valid color. But it is a color nevertheless customized. What about this error?

Code:
Line: 13 Context : .otherInfo 
Property font-color doesn't exist : #5a5b5e
 
Try simply
Code:
color:#5a5b5e;

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
What about this error?

Code:
Line: 89 Context : Arial, Helvetica, Sans-Serif 
Parse Error - Sans-Serif;

Is Sans-Serif an invalid font type?

Thanks.
 
sans-serif and Sans-serif both work fine for me. It's kind of hard to trouble-shoot your css one snippet at a time. The following css will validate, even though the fonts probably don't exist.
Code:
p {font-family: Jones, smith, Omar-Sharif}
What is the rest of line 89?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
OK.

Error 1:

Line: 8
Parse error - Unrecognized : <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, Sans-Serif; color:#5a5b5e; font-size: 12px; }

Line 8 is: (In Bold)

Code:
<style type="text/css">

body
{
font-family: Verdana, Arial, Helvetica, Sans-Serif;
color:#5a5b5e;
font-size: 12px;
[b]}[\b]

-----------------

Line: 82 Context : .caption
attempt to find a semi-colon before the property name. add it

Line 82 is in bold (this action shows a gradient color from white to blue)

Code:
.caption
{
[/b]filter:progid:DXImageTransform.Microsoft.Gradient[b]
      (GradientType=0,StartColorStr='#ffffffff',EndColorStr='#C7D9E6');
height: 1em;
width: 6em;
margin-left: 5em;
margin-top: 1em;
TEXT-ALIGN: center;
FONT-FAMILY: Verdana, Arial, Helvetica, Sans-Serif;
color: #C7D9E6;
}
-----------------------

Line: 89 Context : Arial, Helvetica, Sans-Serif
Parse Error - Sans-Serif;

Line 89 is the following in bold

Code:
.caption
{
filter:progid:DXImageTransform.Microsoft.Gradient
      (GradientType=0,StartColorStr='#ffffffff',EndColorStr='#C7D9E6');
height: 1em;
width: 6em;
margin-left: 5em;
margin-top: 1em;
TEXT-ALIGN: center;
[b]FONT-FAMILY: Verdana, Arial, Helvetica, Sans-Serif;[/b]
color: #C7D9E6;
}

Thanks
 
This validates for me
Code:
body
{
font-family: Verdana, Arial, Helvetica, Sans-Serif;
color:#5a5b5e;
font-size: 12px;
}
Try it without the <style type="text/css">

Your other examples all validate if you remove the 'filter' property. I've not worked with 'filter' so I'm not much help there.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
If this is a stand-alone stylesheet, you do not need or want the [tt]<style type="text/css">[/tt] line. That's an HTML tag and this is a CSS document that you're validating.

The [tt]filter:progid...[/tt] thingie is a Microsoft-only extension to CSS, it's never going to validate. That's not to say that you shouldn't use it, but be aware that the effect will only work in Internet Explorer. A more cross-browser approach to producing a gradient effect would be to use a suitable background image.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
I removed the HTML tags from the stand alone CSS file.

Everybody uses IE within the intranet either through Office, or VPN, or at home where the computers at home are provided by the organization. So I wrote according to IE.

However I did notice that while testing this website on a person who works through VPN in Brasil, the gradient did not work right. It was more like the Submit button had half of white and half of blue as if the button had 2 rows of colors within it. So it was looking very odd. Any software where I can create a small roundish curved rectangle button? We do not have any picture editing software.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top