Jump to content

New to CSS and failing!


jeffamm

Recommended Posts

I hope somebody can help me as I've tried every fix that came to mind, and have been through the W3C CSS Primer and didn't find an answer. Many thanks in advance for reading this,I have an external style sheet at http://www.allmusicmethods.com/main.css that I am working on validating with W3C. There are a bunch of things in need of fixing, but from the ones I've already fixed successfully, I think I know how to fix all the rest but one. It's the first item in the file other than some comments, as follows:/**********************************************************************//* SECTION: HTML GENERIC*//**********************************************************************/body {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif";margin-bottom:0px;margin-top:0px;margin-left:0px;margin-right:0px}p {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif"}The validator gives me the following error:Line: 5 Context : ��� Parse Error - body {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif";margin-bottom:0px;margin-top:0px;margin-left:0px;margin-right:0px} It doesn't give this error for p item immediately following the body item, but if I remove the body item (line 5) it then gives me the same error for the p item. I'm assuming therefore that something must go before these items, after the comments, but I haven't been able to figure out what is missing.The ��� (three boxes) in the context are suspicious but I haven't been able to figure out why they are listed. I've tried to see if there are any invisible characters or other oddballs that would create the boxes but I don't see any. I'm totally stuck - can anyone help me please? Hopefully the fix is obvious to the pros on this board, but this newbie is bewildered.Many thanksJeff

Link to comment
Share on other sites

The problem with the body css not validating is that you've declared measuring units like thismargin-left: 0px;while if you have no margin (also goes for padding) you're not supposed to write "px", "pt", "em" or whatever. Remove the px's and it should be valid.

Line: 61 Context : .CART_REVIEW_TAX Invalid number : cursor hand is not a cursor value : hand
Then it's the cursor, where "hand" is not a valid cursor. You probably want the "pointer", right? http://www.w3.org/TR/REC-CSS2/ui.html#propdef-cursor
Line: 133 Context : .ITEM_ADD_HEADER Invalid number : background Too many values or values are not recognized : whitesmoke
"Whitesmoke" is not a valid background, do a Ctrl+B in notepad to find the place where this is used and replace it with a valid background attribute/color.http://www.w3.org/TR/REC-CSS2/colors.html#q2
Line: 421 Context : a.LEFT_NAV_ANCHOR:hover Invalid number : text-decoration #a6af56 is not a text-decoration value : #a6af56
A color-name can not be a value on text-decoration, it's either overline, underline, linethrough, blink or none.http://www.w3.org/TR/REC-CSS2/text.html#li...-striking-props
Line: 473 Context : .Top50List Invalid number : line-height Parse Error - [empty string]
line-height: ; needs a value.http://www.w3.org/TR/REC-CSS2/visudet.html...def-line-height
Link to comment
Share on other sites

lose the quotesfont-family:verdana, tahoma, arial, sans-serif;
I'll try that but I thought I read that any attribute with a space in it had to quoted - not so?I tried removing the quotes, but just got the same error , but without the quotes, as follows:Line: 5 Context : ��� Parse Error - body {font-size:9pt;font-family:verdana, tahoma, arial, sans-serif;margin-bottom:0px;margin-top:0px;margin-left:0px;margin-right:0px}
Link to comment
Share on other sites

I tried removing the px from the 0 items but still got the same errorLine: 5 Context : ��� Parse Error - body {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif";margin-bottom:0;margin-top:0;margin-left:0;margin-right:0} Any other thoughts?Just want to make sure I'm being clear, there is nothing before this body item other than comments. Is it correct that there is no initiating statement or tag or anything needed? Here's what it looks like:/**********************************************************************//* SECTION: HTML GENERIC*//**********************************************************************/body {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif";margin-bottom:0;margin-top:0;margin-left:0;margin-right:0}p {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif"}/**********************************************************************//* SECTION: GENERIC*//**********************************************************************/.VALUE_LABEL { font-size: 9pt; font-weight:bold ; }.VALUE_LABEL_SM { font-size: 8pt; font-weight:bold ; }.VALUE { font-size: 9pt; background-repeat:no-repeat } etc etc

Link to comment
Share on other sites

I tried removing the px from the 0 items but still got the same errorLine: 5 Context : ��� Parse Error - body {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif";margin-bottom:0;margin-top:0;margin-left:0;margin-right:0} Any other thoughts?Just want to make sure I'm being clear, there is nothing before this body item other than comments. Is it correct that there is no initiating statement or tag or anything needed? Here's what it looks like:/**********************************************************************//* SECTION: HTML GENERIC*//**********************************************************************/body {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif";margin-bottom:0;margin-top:0;margin-left:0;margin-right:0}p {font-size:9pt;font-family:"verdana, tahoma, arial, sans-serif"}/**********************************************************************//* SECTION: GENERIC*//**********************************************************************/.VALUE_LABEL { font-size: 9pt; font-weight:bold ; }.VALUE_LABEL_SM { font-size: 8pt; font-weight:bold ; }.VALUE { font-size: 9pt; background-repeat:no-repeat } etc etc
What? You still got the same error? Are you sure you uploaded the updated css document to test? I tried it, and the error went away...Check out this link. That's a link to the validation of your css file with all the code. At the bottom of the page you get there's the valid css, and body is valid.
Link to comment
Share on other sites

Jonas,I'll try it again, but I believe I validated the correct file because the error message code shows the 0s without the pxs. I'll take a look at what you suggested and try again.Jonas, that link doesn't do anything when I click on it. Would you just give me the URL and I'll check it out.

Link to comment
Share on other sites

<link removed.>^ That's the link....Wait, you're browsing with IE, right? I just tried the link in IE, and I notice it doesn't work. I believe IE has a character limit on the adress field. In Opera, the link opens fine. Firefox too, although Opera loads a lot quicker. :|Hmm, try this then:main.css

Edited by Jonas
Link to comment
Share on other sites

Yes, I'm using IE6.Jonas one other thing - the two errors that indicated I don't have line-height values, but I have valid (I believe) values in them. Here's what's in the file.line 493.Top50ListBold{ font-family:"tahoma, sans-serif"; font-weight: bold; line-height: 2; color:#5f3368; font-size: 8pt; text-decoration: underline;}line 473.Top50List{ font-family:"tahoma, sans-serif"; line-height: 2; color:#5f3368; font-size: 8pt; text-decoration: underline;}These look identical to some of the examples I see in W3C primer. See anything wrong.

Link to comment
Share on other sites

You really should be able to simply use numbers according to the CSS 2 spesification. Try using a length instead:http://www.w3.org/TR/REC-CSS2/visudet.html...def-line-heightOh, and I hope you noticed I edited the previous post:http://w3schools.invisionzone.com/index.ph...ost&p=49247

Link to comment
Share on other sites

Well I finally had some success with problem #1 - the body and p items not passing validation. When I removed the comments string that came first in the document, and just above the body item, the code validated. Perhaps CSS or the validator doesn't like to see comments first thing in a file. Don't know - but problem fixed. I'm now stymied by the line-height problem, where my entries appear to be fine eg line-height: 1.4; but the validator claims there is no value in place for line-height.

Link to comment
Share on other sites

Heh, that's great. :) Warnings validate you know, they're not errors. Still, if you need further help, that's cool. I'm signing off now though, because it's 2:11 AM here... *yawn* :)

Link to comment
Share on other sites

  • 1 month later...
Heh, that's great. :) Warnings validate you know, they're not errors. Still, if you need further help, that's cool. I'm signing off now though, because it's 2:11 AM here... *yawn* :)
Sleepy head Jonas, :)Just posting here insted of makin a new post, how can i make <select> froms more stylish? dont know what that goes under in css, if it is possible at all, background i have but etc the arrow "thing" and borders, i have white borders and normally they are really silverwhite so i think borders work, just need the arrow thing and im happy..->Kristian_C.
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
×
×
  • Create New...