问题
I had a link with text and an image. I don't want the image to have an underline under it but I do want the text to have an underline. Is there anyway to support this without breaking these down into two seperate links? Here is an example picture:

回答1:
No, there is no way to achieve that without splitting the link into two parts.
The alternative is to put border-bottom: 1px solid #000
on to the element containing the text, however this will not behave in the same was as a native A element, with hover, active and visited states - at least not without the intervention of javascript.
回答2:
You could easily do something structured like:
<a><span>text</span><img /></a>
You could then remove the underline from a
and apply underlining to a span
.
Demo here: http://jsfiddle.net/chrisvenus/pdrz9/
I should note that the following will not work:
img {
text-decoration: none;
}
来源:https://stackoverflow.com/questions/8036754/how-to-remove-link-below-image-but-keep-on-text