1 reply [Last post]
Jumentao's picture
Last seen: 6 years 7 weeks ago
Timezone: GMT-3
Joined: 2015-06-10
Posts: 1
Points: 2

Hi guys,

I'm having trouble with my background not working. I'va made a wrapper/container to set my background in it, because I have different backgrounds for each page on the site. If I just put "background: black;" instead of the image that I want as background it works, which is strange since the url to the image is correct.

Here is the code:


<?php include("incl/config.php");
$title = "Hem";
$pageId = "hem";
$pageStyle = null;
<?php include("incl/header.php"); ?>
<div id="containerhome">
<div id="start">
<div id="arrow">
<a href="#arrowtop">
<img src="img/chevronb.png" alt="chevron">
<div id="prev">
<?php include("incl/byline.php"); ?>
<?php include("incl/footer.php"); ?>

from the stylesheet:

#containerhome {
        background: url("img/church.jpg") no-repeat center center fixed;

Anybody has any idea what may be the error?

gary.turner's picture
Last seen: 21 weeks 3 days ago
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Too little info to do more than guess

Do you have that available on a public facing server? That is, can you give us a link to the page?

Else, please post the actual html --- not the php --- and the full css. Then we can make a somewhat better guess. The site structure may be the critical issue, and without seeing it as served, :shrug:

Now, for my SWAG, where is the stylesheet located? Remember, the relative address of the bg image is relative to the stylesheet.

If the image is at /img/church.jpg, and the stylesheet is at /css/mystyles.css, then you have and address error since your style rule expects the image to be at /mystyles/img/church.jpg. This is a very, very common author bug, as we tend to forget that /css has a different starting point from /.



If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.