• Welcome to The Cave of Dragonflies forums, where the smallest bugs live alongside the strongest dragons.

    Guests are not able to post messages or even read certain areas of the forums. Now, that's boring, don't you think? Registration, on the other hand, is simple, completely free of charge, and does not require you to give out any personal information at all. As soon as you register, you can take part in some of the happy fun things at the forums such as posting messages, voting in polls, sending private messages to people and being told that this is where we drink tea and eat cod.

    Of course I'm not forcing you to do anything if you don't want to, but seriously, what have you got to lose? Five seconds of your life?

Assistance getting a background image to work. o.o

kid nino

Egg by day, Trainer by night!
Well, heres my story. Just started making a site. Finished all the menu and the layout and I attempt to put in a background image and wam, it doesn't work. I'm attempting to use a style sheet and would like to know if I'm doing something wrong.

Page I'm adding stylesheet too. This is a .php page by the way.
Code:
<head> 
<link rel=”stylesheet” type=”text/css”
href=”style.css”/>

<meta http-equiv="Content-Language" content="en-us"> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 
<meta name="AUTHOR" content="Layout by Doyle">
<meta name="KEYWORDS" content="Private, Server, Maple, Story, Rune, Scape, RuneScape, Team, Gyro, Kid, Nino, Review, Rating, Newsletter, Top,"> 
<meta name="DESCRIPTION" content="A Private Server Magazine."> 
<title>Gyro Review | Home</title> 
</head>

And, here's my stylesheet. Not much, it's still new and haven't added much.
Code:
hr {color: blue}
body {background-image: url(”background.gif”)}

Before you ask, I know the image is in the correct directory, and I know that I spelled the file name correctly. :grin:

Thanks for any help!
 
Does the horizontal rule color work?

Edit: nvm, get those quotes away from the filename. There shouldn't be quotation marks in your CSS (so far as I can think of, anyway).
 
The horizontal rule or the filename without quotes?

Edit: Actually, the hr shouldn't work either because "color" is for text color, not for the hr... try changing the background-color property on that element instead.
 
Neither work. I took away the quotes.

Thanks for your help so far by the way. :)

EDIT: To your edit, sorry but still nothing. :(
 
In that case, I'm guessing that it has something to do with a part of the page's code that you aren't showing, or with the fact that you're doing this in PHP, about which I don't know. Retrieving the stylesheet at all appears to be the problem.
 
Try deleting the quotation marks in your <link> tag and retyping them. They look like they're the stylized quotes that HTML doesn't understand. Compare them to, say, the shape/angle of the quotes in your <meta> tags--see how they're different?

If that doesn't work, then I'd have to agree with Negrek. Is there anything else you haven't posted?
 
Can you give us a link to the page that this is on? I'll probably be able to help more if I can see the whole thing, and what else might be affecting the background image.
 
Validator dump below; the part about attributes and literals means that your quotes are not valid, so your browser is looking for a file '"style.css"' and that most of the attributes are invalid.

Firefox HTML Validator Plugin said:

HTML Validator result
----------------------
http://gyroreview.freetzi.com/home.php

line 1 - Error: no document type declaration; implying "<!DOCTYPE HTML SYSTEM>"
line 4 column 10 - Error: an attribute value must be a literal unless it contains only name characters
line 4 column 28 - Error: an attribute value must be a literal unless it contains only name characters
line 5 column 5 - Error: an attribute value must be a literal unless it contains only name characters
line 20 column 12 - Error: end tag for element "P" which is not open
line 24 column 55 - Error: there is no attribute "HEIGHT"
line 92 column 10 - Error: end tag for "TABLE" omitted, but its declaration does not permit this
line 66 column 18 - Info: start tag was here
line 92 column 10 - Error: end tag for "DIV" omitted, but its declaration does not permit this
line 65 column 12 - Info: start tag was here
line 92 column 10 - Error: end tag for "TABLE" omitted, but its declaration does not permit this
line 50 column 2 - Info: start tag was here
line 93 column 23 - Error: document type does not allow element "TR" here
line 99 column 23 - Error: document type does not allow element "TR" here
line 102 column 23 - Error: document type does not allow element "TR" here
line 105 column 23 - Error: document type does not allow element "TR" here
line 108 column 25 - Error: end tag for element "TABLE" which is not open
line 109 column 21 - Error: end tag for "CENTER" omitted, but its declaration does not permit this
line 98 column 2 - Info: start tag was here
line 110 column 14 - Error: end tag for element "CENTER" which is not open
line 111 column 10 - Error: end tag for element "TD" which is not open
line 112 column 65 - Error: document type does not allow element "TD" here
line 120 column 18 - Error: end tag for "TABLE" omitted, but its declaration does not permit this
line 115 column 10 - Info: start tag was here
line 121 column 22 - Error: end tag for element "P" which is not open
line 122 column 18 - Error: end tag for "DIV" omitted, but its declaration does not permit this
line 113 column 8 - Info: start tag was here
line 123 column 16 - Error: end tag for element "TR" which is not open
line 124 column 17 - Error: end tag for element "TABLE" which is not open
line 125 column 13 - Error: end tag for element "DIV" which is not open
line 126 column 10 - Error: end tag for element "TD" which is not open
line 126 column 58 - Error: there is no attribute "BORDERCOLOR"
line 126 column 85 - Error: document type does not allow element "TD" here
line 169 column 8 - Error: end tag for element "TR" which is not open
line 169 column 17 - Error: document type does not allow element "TR" here
line 192 column 8 - Error: document type does not allow element "TR" here
line 215 column 21 - Error: end tag for "TABLE" omitted, but its declaration does not permit this
line 195 column 18 - Info: start tag was here
line 216 column 27 - Error: document type does not allow element "TR" here
line 220 column 23 - Error: document type does not allow element "TR" here
line 223 column 23 - Error: document type does not allow element "TR" here
line 226 column 23 - Error: document type does not allow element "TR" here
line 229 column 23 - Error: document type does not allow element "TR" here
line 232 column 23 - Error: document type does not allow element "TR" here
line 235 column 25 - Error: end tag for element "TABLE" which is not open
line 236 column 21 - Error: end tag for element "DIV" which is not open
line 242 column 82 - Error: there is no attribute "WIDTH"
line 242 column 97 - Error: there is no attribute "BEHAVIOR"
line 242 column 122 - Error: there is no attribute "SCROLLAMOUNT"
line 242 column 125 - Error: element "MARQUEE" undefined
line 280 column 17 - Error: document type does not allow element "TR" here
line 282 column 41 - Error: "REVIEW" is not a member of a group specified for any attribute
line 282 column 44 - Error: "IS" is not a member of a group specified for any attribute
line 282 column 46 - Error: "A" is not a member of a group specified for any attribute
line 282 column 54 - Error: "PRIVATE" is not a member of a group specified for any attribute
line 282 column 61 - Error: "SERVER" is not a member of a group specified for any attribute
line 282 column 70 - Error: "MAGAZINE" is not a member of a group specified for any attribute
line 282 column 74 - Error: "AND" is not a member of a group specified for any attribute
line 282 column 77 - Error: "IS" is not a member of a group specified for any attribute
line 282 column 77 - Error: element "BGYRO" undefined
line 282 column 229 - Error: end tag for element "B" which is not open
line 285 column 10 - Error: end tag for element "TABLE" which is not open
line 286 column 5 - Error: end tag for element "DIV" which is not open
line 289 column 3 - Error: document type does not allow element "BR" here
line 289 column 11 - Error: document type does not allow element "CENTER" here
line 289 column 347 - Error: document type does not allow element "BR" here
59 errors / 0 warnings

(Sorry about the junk, but it might be useful to you)
 
Code:
<link rel="stylesheet" type="text/css" href="style.css">

Copy and paste that exactly as you see it, removing the previous one first. Kratos Aurion was right. You should still follow sreservoir's advice and actually validate your HTML, though. The present state of the markup is disgusting.
 
Also, in the stylesheet code that you had, you left out the semi-colons after each statement. So your CSS should be like this:

Code:
hr {color: blue;}
body {background-image: url("background.gif");}

I personally prefer to indent my code, keeping it easier to organise, but it uses more bandwidth:

Code:
hr {
    color: blue;
}

body {
    background-image: url("background.gif");
}
 
...
why does bandwidth matter at that level when you're talking about whitespace
 
It could, if you had a massive stylesheet, and some hosts don't give much bandwidth, so it's precious. For instance, Piplup-Princess kept on using up all it's bandwidth each month with only 75 visitors a day, removing whitespace and using other bandwidth optimizing techniques would have really helped.
 
It also makes the stylesheet entirely unreadable. Honestly, if you're so pressed for bandwidth that you're trying to conserve every bit, you have seriously got to invest in better hosting.
 
Hence why I prefer indented everything. HTML, CSS, PHP, Python and so on. It makes is much, much easier to debug, too.
 
If you have a massive stylesheet, then you're probably doing something wrong.
 
Back
Top Bottom