CSS Triangle Breadcrumb Navigation


/ Published in: HTML
Save to your folder(s)

This is a test case to show that, with a bit more work and a tiny bit more code, CSS traingles can be used for breadcrumb navigation in Internet Explorer 8.


Copy this code and paste it in your HTML
  1. <!doctype html>
  2. <head>
  3. <meta charset="UTF-8" />
  4. <title>Testing CSS Triangle breadcrumbs for IE8</title>
  5. .breadcrumb {
  6. list-style: none;
  7. overflow: hidden;
  8. margin: 0;
  9. padding: 0;
  10. }
  11. .breadcrumb li {
  12. float: left;
  13. }
  14. .breadcrumb li a {
  15. color: white;
  16. text-decoration: none;
  17. padding: 5px 0 5px 50px;
  18. background: #a00; /* fallback color */
  19. background: rgb(140,21,21);
  20. position: relative;
  21. display: block;
  22. float: left;
  23. }
  24. .breadcrumb li a:after {
  25. content: " ";
  26. display: block;
  27. width: 0;
  28. height: 0;
  29. border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
  30. border-bottom: 50px solid transparent;
  31. border-left: 30px solid rgb(140,21,21);
  32. position: absolute;
  33. top: 50%;
  34. margin-top: -50px;
  35. left: 100%;
  36. z-index: 5;
  37. }
  38. .breadcrumb li a:before {
  39. content: " ";
  40. display: block;
  41. width: 0;
  42. height: 0;
  43. border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
  44. border-bottom: 50px solid transparent;
  45. border-left: 30px solid white;
  46. position: absolute;
  47. top: 50%;
  48. margin-top: -50px;
  49. margin-left: 1px;
  50. left: 100%;
  51. z-index: 1;
  52. }
  53. .breadcrumb li.top a {
  54. padding-left: 10px;
  55. z-index: 5;
  56. }
  57. .breadcrumb li.level-2 a { background: rgb(166,25,25); z-index: 4; }
  58. .breadcrumb li.level-2 a:after { border-left-color: rgb(166,25,25); z-index: 4; }
  59. .breadcrumb li.level-3 a { background: rgb(191,29,29); z-index: 3; }
  60. .breadcrumb li.level-3 a:after { border-left-color: rgb(191,29,29); z-index: 3; }
  61. .breadcrumb li.level-4 a { background: rgb(217,33,33); z-index: 2; }
  62. .breadcrumb li.level-4 a:after { border-left-color: rgb(217,33,33); z-index: 2; }
  63. .breadcrumb li.level-5 a { background: rgb(242,37,37); z-index: 1; }
  64. .breadcrumb li.level-5 a:after { border-left-color: rgb(242,37,37); z-index: 1; }
  65. .breadcrumb li.current a {
  66. background: transparent !important;
  67. color: black;
  68. pointer-events: none;
  69. cursor: default;
  70. }
  71. .breadcrumb li.current a:after { border: 0; }
  72. .breadcrumb li a:hover { background: rgb(89,13,13); }
  73. .breadcrumb li a:hover:after { border-left-color: rgb(89,13,13) !important; }
  74. </style>
  75. </head>
  76. <body>
  77. <ol class="breadcrumb">
  78. <li class="level-1 top"><a href="/">Home</a></li>
  79. <li class="level-2"><a href="/vehicles/">Vehicles</a></li>
  80. <li class="level-3"><a href="/vehicles/vans/">Vans</a></li>
  81. <li class="level-4"><a href="/vehicles/vans/camper-vans/">Camper Vans</a></li>
  82. <li class="level-5 current"><a href="/vehicles/vans/camper-vans/1989-vw-westfalia-wagon.html">1989 VW Westfalia Wagon</a></li>
  83. </ol>
  84. </body>
  85. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.