Ghost Echo
Ghost Echo

Reputation: 2067

change z-index of hover background

Is this possible? I've got

<div class="one">
  <a><img src="http://lorempixel.com/100/100"></a>
</div>

I want it so on hover of the div (or <a>) the new hover:background color/image covers the <img>, kind of like the z-index of the hover changes.

So in this fiddle on hover of the <div> or <a> the 100px img wouldn't be visible, everything would be gold.

http://jsfiddle.net/q9Fm3/2/

I'd like to keep the inline <img> element.

Upvotes: 2

Views: 3943

Answers (2)

j08691
j08691

Reputation: 207900

A background image can't be on top of an image in the same element, but you can simulate what you want by adding:

.one:hover img {
    display:none;
}

jsFiddle example

Upvotes: 4

fred02138
fred02138

Reputation: 3361

Just add this rule:

.one:hover img {display:none;}

Upvotes: 0

Related Questions