1

I have a background image defined in style.css for H1:

h1 {
    padding:10px 10px 5px 43px;
    margin: 0px 0px 0px 0px;
    overflow:hidden;
    background:url('../images/marker2.png') 17px 5px no-repeat; 
    color:#7c7960; 
    font-size: 1.40em; 
    line-height:18px; 
    font-weight:bold; 
    text-transform:uppercase;
}

But in certain H1 headers, i don't want this background image to appear? How to make exception in below code so that background image doesnt show?

<h1 itemprop="name" ><?php echo $products_name; ?></h1> 
JJJ
  • 32,902
  • 20
  • 89
  • 102
  • 1
    You should bother to do a search before posting a question: http://stackoverflow.com/questions/1461077/how-do-i-remove-background-image-in-css – Basil Bourque Feb 16 '13 at 10:59

5 Answers5

1

Write like this:

h1[itemprop="name"]{
 background-image:none;
}

For example check this http://jsfiddle.net/X2Aef/

sandeep
  • 91,313
  • 23
  • 137
  • 155
1

This will work.

<h1 itemprop="name" style="background-image: none;" ><?php echo $products_name; ?></h1> 
0

Try this:

<h1 itemprop="name" style="background:none;"><?php echo $products_name; ?></h1> 
Alessandro Minoccheri
  • 35,521
  • 22
  • 122
  • 171
0

You can add class like h1.noBg{background:none} and pass this to the elements where background is not required.other option is use inline style elements like

<h1 itemprop="name" style="background:none;">

But this is not a good practice. Using class to override a rule is better.

Deepak Kamat
  • 1,880
  • 4
  • 23
  • 38
Rajnish Bakaria
  • 116
  • 1
  • 3
0

this should work

<h1 itemprop="name" style="background:none !important;"><?php echo $products_name; ?></h1>
Bilal Fazlani
  • 6,727
  • 9
  • 44
  • 90