homepage Welcome to WebmasterWorld Guest from 54.226.136.179
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Limit link underline to text
No line under the image
Rain_Lover



 
Msg#: 4293715 posted 4:20 pm on Apr 7, 2011 (gmt 0)

I'd like to have the underline for the text only and at the same keep the image part of the link:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Test</title>

<style type="text/css">
a:hover {text-decoration:none;}
img {border:none; vertical-align:bottom; padding-left:15px}
</style>

<a href="#">Subscribe to feed<img src="http://www.google.com/phone/static/images/feed-icon.gif" alt=""></a>


The code result isn't the same in all major browsers.
Many thanks for any help!

 

alt131

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4293715 posted 12:36 pm on Apr 9, 2011 (gmt 0)

Try adding margin-right:-31px to the css for the image.
(Where 31 = 15px padding + 16px image width)

Rain_Lover



 
Msg#: 4293715 posted 5:05 pm on Apr 9, 2011 (gmt 0)

Simple and neat! Thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved