Forum Moderators: not2easy

Message Too Old, No Replies

CSS Parse Errors when validating

I'm new and I'm sure it's something silly.

         

Spacebird

12:38 pm on Oct 3, 2005 (gmt 0)



* Line: 62 Context : #container

Parse Error - ` background: url(Images/side_background.gif) left repeat-y;

* Line: 64

Lexical error at line 65, column 3. Encountered: <EOF> after : ""

I get that when running this portion of an otherwise-validated stylesheet through the W3C Validator:

#container { 
margin: 0;
width:700px;
height:100%;
position: relative;
`background: url(Images/side_background.gif) left repeat-y;
text-align: left;
}

I also tried submitting it as:

#container { 
margin: 0;
width:700px;
height:100%;
position: relative;
`background: url(Images/side_background.gif) left repeat-y;
text-align: left;
}

and got:

* Line: 6 Context : #container

Parse Error - ` background-image:url(Images/side_background.gif);

* Line: 7 Context : background-repeat

Parse Error - repeat-y;

* Line: 8 Context : background-position

Parse Error - left;

* Line: 10

Parse Error - : left; }

This is my first attempt to use CSS to this extent in a website, and I'm sure I'm missing something silly. Seeing the responses to other posts, I'm thinking this is the place to go for advice. Any ideas?

Spacebird

12:42 pm on Oct 3, 2005 (gmt 0)



Nevermind. I found the error. I feel dumb now.

But, I do have another question. The point of the above code is to get 'side-background.gif' to repeat indefinetly down the page within the #container. As it stands now, it's showing up once, and not repeating. Any ideas on that one?

dcrombie

12:42 pm on Oct 3, 2005 (gmt 0)



Why do you have a ` before background?

Spacebird

12:49 pm on Oct 3, 2005 (gmt 0)



That was the error. It's a little harder to see in notepad...

Anyway, I've gotten everything set so that the W3C validators think I'm great. However, so long as I have the <!DOCTYPE> header in the file, neither Firefox or IE will load the background image. I'm using the doctype off the W3C website, that is:

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

Also, how can I make the background image span the length of the page and not move (i.e., when I scroll, it stays where it is)?

tedster

1:39 pm on Oct 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



when I scroll, it stays where it is

background-attachment: fixed;

so long as I have the <!DOCTYPE> header in the file, neither Firefox or IE will load the background image

Sounds odd -- have you validated the html?

One thing you are doing that is not a best practice is capitalizing the "Images" directory - by any chance is that word actually lower case, or crossed up in some other way?

Spacebird

1:52 pm on Oct 3, 2005 (gmt 0)



For the background hint: thanks.

For the image directory: no, it really is capitalized. It hasn't caused me any problems thus far. And yes, the HTML is validated with zero errors (when the DOCTYPE is there of course).

When I delete the doctype tag, everything works perfectly in IE. Firefox still renders oddly, I'm not sure why.