Not sure why, but my layout doesn't display the sign in buttons.
CSS:
.sign-in {
position: absolute;
left: 895px;
top: 30px;
width: 96px;
height: 36px;
background-image: url('button_sign-in.png');
}
.sign-in:hover {
background-image: url('button_hover_sign-in.png');
}
HTML:
<a class="sign-in" href="#" title="Sign In"></a>
The box is there and is click able, just no images in it. The images defiantly exist and are in the same folder as the html file.
Any ideas? Thanks!
-
Is the image in the same folder as your css? You need the full path to the image.Andrew– Andrew2013年11月14日 14:08:14 +00:00Commented Nov 14, 2013 at 14:08
-
Could it be the dash in your filenames? (I doubt it, but worth a shot)Tim– Tim2013年11月14日 14:11:34 +00:00Commented Nov 14, 2013 at 14:11
-
Just go to developer tool (by clicking F12). see the console for any error related to 404Sachin– Sachin2013年11月14日 14:13:08 +00:00Commented Nov 14, 2013 at 14:13
1 Answer 1
The location of the HTML file is not relevant.
Paths in CSS are relative to the location of the CSS file, not the HTML file being displayed.
For example if your CSS file was in a subdirectory (e.g. /css) of the directory that holds the HTML file and images, you need to change your paths from url(your_image.png) to url(../your_image.png).
If you open the "Network" tab in Firefox or Chrome Developer Tools you can see a list of network requests, which will include the (presumably) 404'd GET requests for the images. You can check the path there and adjust accordingly.