048-link-pseudo.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>048 link pseudo-class</title>
  6. <style>
  7. body { background: #ffffff; color: #202020; font-family: sans-serif;
  8. margin: 12px; }
  9. a:link { color: #000000; text-decoration: none; }
  10. a:visited { color: #ff0000; }
  11. a:hover { color: #00aa00; }
  12. </style>
  13. </head>
  14. <body>
  15. <h1>048 &mdash; a:link colour</h1>
  16. <p>Without pseudo-class support the engine uses the dark theme accent, so the
  17. link below is blue; <code>a:link</code> must make it black. The red
  18. visited and green hover rules must not stick permanently.</p>
  19. <p><a id="link" href="#target">BLACK LINK TEXT</a></p>
  20. <div id="result" style="background: #ffc8c8; color: #000000; padding: 8px;
  21. font-size: 18px;">checking...</div>
  22. <script>
  23. setTimeout(function () {
  24. var a = document.getElementById('link');
  25. var c = getComputedStyle(a);
  26. var ok = c.color === 'rgb(0, 0, 0)';
  27. var r = document.getElementById('result');
  28. if (r) {
  29. r.style.background = ok ? '#c8f0c8' : '#ffc8c8';
  30. r.textContent = (ok ? 'LINK-OK ' : 'LINK-FAIL ') + c.color;
  31. }
  32. }, 300);
  33. </script>
  34. </body>
  35. </html>