views:

15

answers:

1

I am using something like this:

.entry a {
  padding: 2px 0 0 8px;
  background: transparent url(images/link_arrow_light.gif) left top no-repeat;
  text-decoration: underline;
}

Which works fine but adds that image to all links (images, h3 tags, ...)

Is there a css way to have it only appear besides links that are within p-tags?

+2  A: 
.entry p a {

This forces the <a>s to be a descendent of a <p> (while the <p>s must also be descent of some tags with the class entry.)

KennyTM
Simple but couldn't think of this.
Julian
But images still have the image. .entry p a img {background:none;} didn't work? thanks
Julian
@Julian: Unfortunately, that's not possible with CSS alone. You can to add a class to those `<a>` with `<img>` and set the `background:none` for those class.
KennyTM
The background image will appear on the <a> that wraps an <img>, not on the image itself. That is why your suggestion above didn't work. Do you not have access to the html? If you do just add a class to links that wrap an image and the set that class to have no background
lnrbob
Thanks, just what I was thinking. I hardcoded it now.
Julian