jn025
jn025

Reputation: 2895

css image link change opacity on hover

<div id="contentwrap">
<a id="contentimage" href=""></a>
    <p class="content">
        </p>
    </div>

 #contentimage {
    display:block;
    background:url(../images/contimg.jpg);
    top:500px;
    width:500px;
    height:400px;
    position:relative;
}
#contentimage:hover {
    opacity:0.5;
}

I'd like the opacity of the image link to change when I hover. However it's not even treating the image as a link (no click option)?

Upvotes: 0

Views: 9237

Answers (2)

RealityPC
RealityPC

Reputation: 137

Maybe you can try this:

<img id="contentimage" src="link to image">

Upvotes: 1

srgsanky
srgsanky

Reputation: 765

The code looks good except for one error.
In your css, use url with quotes
background:url('../images/contimg.jpg');

Edit: Your code works fine.

Upvotes: 0

Related Questions