1

Demo

I'm using

a::after {
  content: " »";
}

to style links. It works:

<a href="#">Some linked Text</a> 

Sadly I now get a „»“ after linked images, what I don't want that:

<a href="#"><img src="test.jpg"></a>

What do I have to change in order to get „»“ after linked words, but not after linked images?

user3656083
  • 219
  • 1
  • 9
  • Possible duplicate of [CSS selector - element with a given child](https://stackoverflow.com/questions/4220327/css-selector-element-with-a-given-child) – Heretic Monkey Oct 07 '18 at 16:28

2 Answers2

2

I don't know if I understand your problem, but if you only want the simbol in texts, you can use classes to delimit it.

.text::after {
  content: " »";
}
<a href="#" class="text">Some linked Text</a> 
<br><br>

<a href="#" class="img"><img src="test.jpg"></a>
Lleims
  • 1,107
  • 9
  • 27
1

You can try to hide the symbol under the image using negative margin:

a::after {
  content: " »";
}
a img {
  margin-right:-13px;
  position:relative;
  vertical-align:top;
}
<ul>
  <li><a href="#">Some linked Text</a> </li>
  <li>
    <a href="#"><img src="https://picsum.photos/100/100?image=0"></a>
  </li>
</ul>
Temani Afif
  • 211,628
  • 17
  • 234
  • 311