暫無描述

css_important_flag.html 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
  5. <style>
  6. ul { line-height:160% }
  7. a {
  8. border-bottom:dashed 1pt red !important;
  9. text-decoration:none !important;
  10. }
  11. .monospace { font-family:monospace !important; }
  12. </style>
  13. </head>
  14. <body>
  15. <h1>Handling of "!important" property flag</h1>
  16. <p>
  17. Normally later css style properties defined later are overriding earlier ones.<br>
  18. Except if they are marked with the flag "!important".<br>
  19. Those can only be overridden by style properties which are also marked "!important".
  20. </p>
  21. <p>There are two classes of property overriding</p>
  22. <ul>
  23. <li>inherit (nested html tags)</li>
  24. <li>merging (more css properties to the same html tag)</li>
  25. </ul>
  26. <p>This is handled similarly for all styles, so we check only examples here</p>
  27. <p>ul { line-height:160% }<p>
  28. <h2>merge a { border-bottom:dashed 1pt red !important; text-decoration:none !important; }</h2>
  29. <p>dummy links, text decoration/border bottom:</p>
  30. <ul>
  31. <li><a href="">(default)</a></li>
  32. <li><a href="" style="border-bottom-style:none;">border-bottom-style:none; (ignore)</a></li>
  33. <li><a href="" style="border:1pt solid blue;">border:1pt solid blue; (ignore)</a></li>
  34. <li><a href="" style="border-bottom-style:none!important;">border-bottom-style:none!important; (override)</a></li>
  35. <li><a href="" style="border:1pt solid blue!important;">border:1pt solid blue!important; (override)</a></li>
  36. </ul>
  37. <h2>Inherit .monospace { font-family:monospace !important; }</h2>
  38. <p>font family selection:</p>
  39. <ul class="monospace">
  40. <li>(default)</li>
  41. <li class="font-family:sans-serif;">font-family:sans-serif; (ignored)</li>
  42. <li style="font-family:sans-serif!important;">font-family:sans-serif!important; (override)</li>
  43. </ul>
  44. </body>
  45. </html>