Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't set background-image for a specific div

Some strange behavior about background image

HTML

<body>  

<div id="divGaLL">
<ul id="ulGaLL">
<li>...</li>
<li>...</li>
</ul>
</div>  

</body>

CSS

body{
    background:url(img/back01.jpg); //works
}

#divGaLL{
   background:red;  // works        
   background:url(img/back01.jpg);  //doesn't work
}

#ulGaLL{
    background:url(img/back01.jpg);  //works
}

Why I can't set back01.jpg as background for #divGaLL?

like image 537
qadenza Avatar asked Dec 12 '22 14:12

qadenza


1 Answers

That is because you are using the same property and different values. When you are using background: you can write color and image in same line

#divGaLL{
   background:url(http://cdn1.iconfinder.com/data/icons/free-scuba-diving-icon-set/128/fish.png) red;  
}

DEMO

like image 148
Sowmya Avatar answered Dec 27 '22 09:12

Sowmya