CSS Parse Error

ronbo613

Golden Member
Jan 9, 2010
1,237
45
91
I have a parse error validation problem with this line of code in my CSS document:

#masthead{ margin: 0; padding: 25px 10px 10px 10px; border-bottom: none; width: auto; }

I'm not sure what is wrong with it, there aren't any display or loading problems. It's a simple XHTML 1.0 Transitional page, nothing fancy.
Any ideas?
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
Code:
#masthead
{ 
  margin: 0; 
  padding: 25px 10px 10px 10px; 
  border-bottom: none; 
  width: auto;
}
Unless you are putting it in a style tag, CSS generally shouldn't be one line like this. (I don't know if that is what is causing the error). Also, do you have more than one element on the page with the ID "masthead"?

Heck, something like this
Code:
#masthead {
margin: 0; 
padding: 25px 10px 10px 10px; 
border-bottom: none; 
width: auto; }
Uses just as many bytes as what you posted (same size) but is much more readable.

What is giving you the parse error? Not everything that parses css is made equally (look at IE5 for example).
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
I really doubt it's the lack of line breaks, but I also don't see anything wrong with it. Will echo Cogman's question: what tool is complaining?
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Whenever I have weird parse errors like this, I open a text editor and set it to show whitespace and newline characters.

I usually end up finding a stray carriage return or something like that.
 

ronbo613

Golden Member
Jan 9, 2010
1,237
45
91
Will echo Cogman's question: what tool is complaining?
I've been looking into getting a more mobile friendly website and was using the W3C Mobile Checker which told me "The CSS style sheet is not syntactically valid CSS", so I checked it out with the W3C CSS Validation Checker.
I usually use Dreamweaver CS4 to generate web pages, then tweak the code by hand to make it work the way I want. I just don't see any problems with this code. It's the only #masthead element on the page. All the other elements are coded exactly like the masthead, but no errors with any of them.
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
I've been looking into getting a more mobile friendly website and was using the W3C Mobile Checker which told me "The CSS style sheet is not syntactically valid CSS", so I checked it out with the W3C CSS Validation Checker.
I usually use Dreamweaver CS4 to generate web pages, then tweak the code by hand to make it work the way I want. I just don't see any problems with this code. It's the only #masthead element on the page. All the other elements are coded exactly like the masthead, but no errors with any of them.

Both tools you gave as an example have reported no issues with the line of code you gave use. Are you sure that you are reading the output correctly?