Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background-image not working

I have this in my HTML everything works except the background-image: 'images/Header.jpg'; Instead I see the grey color in the header but not the image.. I tried removing the grey color but still dont see the image...

#outerWrapper #header {
border-bottom: solid 1px #628152; 
font-size: 18px;
font-weight: bold;
line-height: 15px;
height: 115px;
background-color: Grey;
background-image: url('images/Header.jpg');

How can I make this work.. please help.. thanks

like image 756
user175084 Avatar asked Dec 01 '10 16:12

user175084


4 Answers

What is the path of your CSS file and the path of the image?

You must take in account that, when using url() in CSS, the path is relative to CSS file, not to the requested page.

Imagine you have the following files:

/website/index.html
/website/templates/main.css
/website/images/header.jpg

than the CSS must be:

.style{background-image:url(../images/header.jpg);} /* Noticed "../"? */
like image 118
Arseni Mourzenko Avatar answered Sep 28 '22 13:09

Arseni Mourzenko


Have a look at your page with Firebug for Firefox. You may not be loading the image properly. You will also be able to play with the css on the fly if that's your issue.

like image 27
Lareau Avatar answered Sep 28 '22 15:09

Lareau


Try changing the url to '/images/Header.jpg'

like image 38
Mark Avenius Avatar answered Sep 28 '22 13:09

Mark Avenius


Sure you need the ' char? And maybe it is case sensitive and you have a mistake in the url.. Maybe background-image:url(images/header.jpg);

like image 21
bAN Avatar answered Sep 28 '22 14:09

bAN