CptQwark

Styling Links with IDs and Classes

Apr 22nd, 2016
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Class and ID Based Links</title>
  5.     <meta charset="UTF-8">
  6.  
  7. <style>
  8.  
  9.     a:link, a:visited {
  10.         color: red;
  11.     }
  12.  
  13.     a:hover {
  14.         color: green;
  15.     }
  16.  
  17.     a:active {
  18.         color: blue;
  19.     }
  20.  
  21.     #id a:link, #id a:visited {
  22.         color: orange;
  23.     }
  24.  
  25.     #id a:hover {
  26.         color: lime;
  27.     }
  28.  
  29.     #id a:active {
  30.         color: purple;
  31.     }
  32.  
  33.     a:link.class, a:visited.class {
  34.         color: pink;
  35.     }
  36.  
  37.     a:hover.class {
  38.         color: black;
  39.     }
  40.  
  41.     a:active.class {
  42.         color: white;
  43.     }
  44.  
  45. </style>
  46. </head>
  47.  
  48. <body>
  49.  
  50.     <h1><a href="">Link 01 (a)</a><h1>
  51.  
  52.     <h1 id="id"><a href="">Link 02 (id)</a></h1>
  53.  
  54.     <h1><a href="" class="class">Link 03 (class)</a></h1>
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment