Reputation: 2081
i set up a style for all my links but the problem is that any anchor that has an image obviously will have the same style.
is there any way i can overwrite the style for the images without having to apply a class to all the images that removes that style?
Upvotes: 1
Views: 7221
Reputation: 3006
I would recomend rewriting your code to not use images but for your links with images just use clickable divs displayed as blocks.
<div id="x"><a href=".." class="y"></a></div>
.y {
display: block;
}
#x {
width:..;
height:..;
padding:0;
margin:0;
background-image:url(IMGPATHHERE!);
}
#x:hover {
width:..;
height:..;
padding:0;
margin:0;
background-image:url(THEHOVERIMGHERE!);
cursor:hand;
}
Upvotes: 3
Reputation: 29091
No, there is no CSS selector which will capture <a>
elements which contain only an <img>
element. You will need to apply a class either at design-time or at run-time with javascript.
Upvotes: 1
Reputation: 12791
a img {
/* alternative style for hyperlinked images */
}
Upvotes: 3