How to use a CSS background image as a hyperlink
This snippit of HTML and CSS will let you use a background image in CSS and use it as a hyperlink in HTML. Here’s the code.
HTML Code:
<a id="test" href="http://yourlink.com">This will get moved off screen</a>
CSS:
a#test{
display:block;
width:100px;
height: 50px;
background: url(images/yourimage.jpg) no-repeat;
text-indent: -9999px;
}
Many thanks to R1gM for this.
No related posts.
This entry was posted on Wednesday, January 6th, 2010 at 12:58 am and is filed under Hints n' Tips.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Leave a Reply
Hot Topics
- Creating a Drupal 6 custom login form – Step by Step tutorial.
- WordPress Contact Form 7 & WP-Mail-SMTP problem solved
- 7129/6105195 Edward Leedskalnin’s anti-gravity – How he built Coral Castle.
- imagecache wrong path – SOLVED!
- How to take Ownership of a Drive, Folder or File in Windows 7
- WordPress widgets not saving or dragging?
- Firefox – update favicon.ico (SOLVED)
- IE emulator for FireFox
- Site off-line The site is currently not available due to technical problems. Please try again later. Thank you for your understanding. (SOLVED!)
- Access denied – Drupal 6.x
Archives
- February 2012
- November 2011
- September 2011
- August 2011
- June 2011
- January 2011
- December 2010
- November 2010
- October 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- January 2009
- December 2008
- August 2008
- June 2008
