Created
October 29, 2011 15:06
-
-
Save juanm55/1324560 to your computer and use it in GitHub Desktop.
HTML links with images that aren't underlined
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* the idea here is to create a link with an image AND some text,,,, but ONLY the text gets underlined*/ | |
/* with this setup and CSS it is not possible to take out the underline of the img element (since it is an in-line element)*/ | |
<a href=#><img src="path/to/file" /> some text</a> | |
/* Because 'a' styling is supposed to have text-decoration:underline; and that affects the image too.... | |
even with: | |
a img {text-decoration:none;} | |
*/ | |
so the hack comes here.... CSS this: .imagelink{text-decoration:none} | |
and in HTML: <a href=# class="imagelink"><img src="path/to/file" /> <u>some text</u></a> | |
where we can see how useful the <u> is.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment