Advertisement
PayneLess_Designs

Background Image as Link II

Jun 20th, 2011
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.43 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
  3. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  4. <title>Background Image as Link II</title>
  5. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  6. <link href="css_page_designs.css" rel="stylesheet" type="text/css" />
  7. <meta name="description" content="" />
  8. <meta name="keywords" content="" />
  9. <meta name="author" content="" />
  10. <style type="text/css">
  11. #logolink {
  12. display: block;
  13. width: 256px;
  14. height: 256px;
  15. background: url(http://i160.photobucket.com/albums/t184/PayneLess_Designs/Backgrounds/bg_04.jpg) no-repeat center scroll;
  16. }
  17.  
  18. #bglink span {
  19. display: none;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <h1>Background Image as Link II</h1>
  25. <div id="wrap">
  26. <div id="contents">
  27.  
  28. <p><a id="logolink" href="http://paynelessdesigns.com/" title="PayneLess Designs"></a></p>
  29.  
  30. <p>The anchor tag is naturally inline so you need to make it a block in order to hold a shape without inner content. The height &amp; width are those of the image.</p>
  31.  
  32. <p>To make this work in a non-CSS user agent as well, you might want to add something like this: #bglink span { display: none; }</p>
  33.  
  34. <p><a id="bglink" href="#"><span>Click my logo</span></a></p>
  35.  
  36. <p>If CSS isn't enabled, the text link replaces the image link.</p>
  37.  
  38. </div></div>
  39. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement