How to select text, but not images, in CSS

Posted by thinkswan on Stack Overflow See other posts from Stack Overflow or by thinkswan
Published on 2010-03-20T10:25:11Z Indexed on 2010/03/20 10:31 UTC
Read the original article Hit count: 568

Filed under:
|
|
|

Simple question: I have the following markup...

<a href='#'>
  <img src='icon.png'> This is the link
</a>

I want to have the text become underlined on mouseover.

What is the CSS selector for selecting only the text in that <a> element and nothing else? I'd rather not wrap it in anything if I don't have to.

a:hover {
  text-decoration: none;
}
a:hover <select_text_here> {
  text-decoration: underline;
}

© Stack Overflow or respective owner

Related posts about html

Related posts about css