0

Hi
(little problem im not expert in css)
i have a div if i change background color it successfully change it but if i add image then it does not change background color of div here is my code

 <div class="Cartoon">
 <img src="App_Themes/White/Images/male.png" class="imgMale" />                 
 <div  class="male"><p>In a Nutshell|</p>
 <span>this is some text</span>
 </div>
 </div>

 <style type="text/css">
 .Cartoon
 {
 background-color: yellow;           
 }
 </style>


(No jQuery and No Javascript only in css) you can check heres the url parkingticketpal.com/HowItWorks.aspx

skhurams
  • 2,133
  • 7
  • 45
  • 82

3 Answers3

0

You need to clear your .Cartoon div since it contains floated elements.

What methods of ‘clearfix’ can I use?

Community
  • 1
  • 1
Dave Kiss
  • 10,289
  • 11
  • 53
  • 75
0

You will not see your background color because the Image is already on the background. Try

.cartoon{
   background: yellow;
   z-index: 9999
}

Then the div is above the image so that you can see the background.

Hint: Try making div bigger than the image.

Tepken Vannkorn
  • 9,648
  • 14
  • 61
  • 86
0

try this

`

<style type="text/css">

{
background-image:url('gradient2.png');
background-repeat:repeat-x;
}
</style>

`

Pilli
  • 171
  • 4