PayneLess_Designs

Easy CSS Tooltip

Jun 20th, 2011
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.39 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. <title>Easy CSS Tooltip</title>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <meta name="author" content="Ron" />
  6. <meta name="date" content="3/10/2009" />
  7. <meta name="copyright" content="PayneLess Designs" />
  8. <style type="text/css">
  9. * { margin: 0; padding: 0; border: 0; }
  10.  
  11. body {
  12. font-size: 1.25em;
  13. color: #000;
  14. background: #808080; /* Gray */
  15. }
  16.  
  17. div#wrap {
  18. width: 85%;
  19. margin: 2% auto;
  20. padding: 10px;
  21. border: 5px inset #070;
  22. background: #dcdcdc; /* Gainsboro */
  23. }
  24.  
  25. h1, h2, h3, h4 {
  26. text-align: center;
  27. color: #800000; /* Maroon */
  28. }
  29.  
  30. p { margin: 2% 0; }
  31.  
  32. a:hover { background: #fff; text-decoration: none; } /*BG color is a must for IE6*/
  33. a.tooltip span { width: 150px; font-size: .5em; display: none; padding: 2px 3px; margin-left: 8px; }
  34. a.tooltip:hover span { display: inline; position: absolute; background: #fff; border: 1px solid #ccc; color:#6c6c6c; }
  35. </style>
  36.  
  37. <!--[if IE]>
  38. <style type="text/css">
  39. div#wrap {
  40. width: 95%;
  41. margin: 2% auto;
  42. padding: 10px;
  43.  
  44. }
  45. p, pre { font-size: .65em; }
  46. a:hover { background: #fff; text-decoration: none; } /*BG color is a must for IE6*/
  47. a.tooltip span { font-size: .65em; display: none; padding: 2px 3px; margin-left: 8px; width: 160px; }
  48. a.tooltip:hover span { display: inline; position: absolute; background: #ffffff; border: 1px solid #ccc; color:#6c6c6c; }
  49. </style>
  50. <![endif]-->
  51. </head>
  52. <body>
  53. <div id="wrap">
  54. <h1>Easy CSS Tooltip</h1>
  55. <p>Easy <a class="tooltip" href="#">Tooltip<span>This is the crazy little Easy Tooltip Text.</span></a></p>
  56.  
  57. <p>If you want to display a tooltip for a link, just add the class "tooltip" to the link and write your Tooltip Text in a span tag within the a tag - thats it.</p>
  58.  
  59. <h3>CSS:</h3>
  60. <pre>
  61. a:hover { background: #fff; text-decoration: none; } /*BG color is a must for IE6*/
  62.  
  63. a.tooltip span { width: 150px; font-size: .5em; display: none; padding: 2px 3px; margin-left: 8px; }
  64.  
  65. a.tooltip:hover span { display: inline; position: absolute; background: #fff; border: 1px solid #ccc; color:#6c6c6c; }
  66. </pre>
  67.  
  68. <h3>HTML:</h3>
  69. <pre>&lt;p>Easy &lt;a class="tooltip" href="#">Tooltip&lt;span>This is the crazy little Easy Tooltip Text.&lt;/span>&lt;/a>&lt;/p></pre>
  70. </div>
  71. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment