html - need to display background image of link inline with text links correctly -
i want display facebook-footer-rect.png link, , provide wording in link tag screen readers.
<a href="http://facebook.com/ourpage" title="join on facebook" rel="external" class="facebook-footer">join on facebook</a>
example html of links:
<div class="footer-links"> <p> <a href="link">link 1</a> <a href="link">link 2</a> <a href="link">link 3</a> <a href="link">link 3</a> <a href="http://facebook.com/ourpage" title="join on facebook" rel="external" class="facebook-footer">join on facebook</a> </p> </div>
css footer-links , facebook-footer
.footer-links { line-height:1.9em; text-align:center; margin: 0; } .footer-links a:visited, .footer-links a:link { display:block; padding:7px; background-color:#216e4f; text-decoration:none; display:inline; } .footer-links p { margin:0 0 10px 0; } .footer-links a:hover { background-color:#337a5d; text-decoration:none; display:inline; } .footer-links a.facebook-footer:link, .footer-links a.facebook-footer:visited { background: url('/images/uploads/images/facebook-footer-rect.png') no-repeat left top; height:28px; width:81px; display: inline; text-decoration: none; overflow: auto; text-indent: -10000px; font-size: 0px; line-height: 0px; }
screenshot of looks like:
w/ facebook-footer display: block; http://cl.ly/4tby
w/ facebook-footer display:inline; http://cl.ly/4twi
this want like: http://cl.ly/4tvx (photoshopped this)
update: added display: inline-block; , vertical-align:top; someone's suggestion , looks this: http://cl.ly/4tu8
css .facebook-footer
.footer-links a.facebook-footer:link, .footer-links a.facebook-footer:visited { background: url('/images/uploads/images/facebook-footer-rect.png') no-repeat; height:28px; width:81px; display: inline-block; text-decoration: none; vertical-align: top; overflow: auto; text-indent: -10000px; font-size: 0; line-height: 0; }
demo of code http://jsfiddle.net/shsym/
yes! got it... puzzling, 1 inline-block should work.
remember inline-block isn't supported all major browsers (ie7 incomplete).
.footer-links a.facebook-footer:link, .footer-links a.facebook-footer:visited { /* set repeat, blue can come @ bottom well, not needed.*/ background: url("http://i56.tinypic.com/339hu0l.png") repeat scroll 0 0 transparent; display: inline-block; font-size: 1.9em; height: 1em; padding: 0; /* no padding, tested 1 in ff , ie8 */ vertical-align: top; /* bottom seems work well*/ width: 81px; } .footer-links p { margin:0 0 10px 0; overflow:hidden; /* important change, makes them of same size */ }
check jsfiddle here: http://jsfiddle.net/shsym/1/
Comments
Post a Comment