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:
Home.php
<?php include("incl/config.php"); $title = "Hem"; $pageId = "hem"; $pageStyle = null; ?> <?php include("incl/header.php"); ?> <div id="containerhome"> <div id="start"> <h1>Welcome</h1> </div> <div id="arrow"> <a href="#arrowtop"> <img src="img/chevronb.png" alt="chevron"> </a> </div> <div id="prev"> <h3>Article</h3> </div> </div> <?php include("incl/byline.php"); ?> <?php include("incl/footer.php"); ?>
from the stylesheet:
#containerhome { background: url("img/church.jpg") no-repeat center center fixed; background-size:cover; }
Anybody has any idea what may be the error?
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 /.
cheers,
gary