If I have the following code in the head of the document, the banner image is displayed:
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javascript/copyNote.js"></script>
<style type="text/css">
<!--
#banner
{
margin: 0 auto;
width: 980px;
height: 198px;
background-image:url(images/banner.gif);
}
-->
</style>
But if I move the above code to the linked external style sheet (css/styles.css) everything shows up except the banner image.
Anyone know what I'm doing wrong?
here is the link to the page: http://www.healthquestpt.com/hpc/
I was able to move all the css to the external style sheet except the banner
the external sheet is here: http://www.healthquestpt.com/hpc/css/styles.css
the image path shouldn't change since the image is still in the image folder, right?
BcSurvivor08 wrote:
the image path shouldn't change since the image is still in the image folder, right?
Yes, but the path to the image in the CSS must be relative to the location of the external CSS file.
In other words, the following rule in the home page
#banner
{
margin: 0 auto;
width: 980px;
height: 198px;
background-image:url(images/banner.gif);
}
would be written in the external CSS file as
#banner
{
margin: 0 auto;
width: 980px;
height: 198px;
background-image:url(../images/banner.gif);
}
because the CSS file is inside the css folder (one level down from the root folder).
../ says "From the "css" folder, go up a folder level then look for banner.gif inside the "images" folder..
North America
Europe, Middle East and Africa
Asia Pacific