• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

CSS Parse Error

ronbo613

Golden Member
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?
 
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).
 
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?
 
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.
 
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.
 
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?
 
Back
Top