CSS For Cascading Menu


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

Stylesheet for Cascading Menu. Fixed width.


Copy this code and paste it in your HTML
  1. /* Style Sheet for CasMenu.html */
  2.  
  3.  
  4.  
  5. *{
  6. margin:0;padding:0;border:0; /* -- reset code -- */
  7. }
  8.  
  9. body {
  10. font-family: verdana;
  11. background-color: #AABBCC;
  12. margin: 2% auto;
  13. width: 500px;
  14. clear: both;
  15. }
  16.  
  17. h2 {
  18. color: #EFFCDE;
  19. text-align: center;
  20. background-color: #111111;
  21. border: 2px solid #ABFDBD;
  22. border-radius: 5px;
  23. margin-bottom: 50px;
  24. }
  25.  
  26. /* Menu-behaviour styling */
  27.  
  28. ul {
  29. list-style-type: none;
  30. }
  31.  
  32. ul#navmenu li {
  33. width:100px;
  34. text-align: center;
  35. position:relative;
  36. float: left;
  37. }
  38.  
  39. ul#navmenu a {
  40. text-decoration: none;
  41. display: block;
  42. height: 30px;
  43. line-height: 30px;
  44. background-color: #FFF;
  45. border: 1px solid #000;
  46. border-radius: 6px;
  47. }
  48.  
  49. ul#navmenu .sublvl1 a{
  50. margin-top: 5px;
  51. }
  52.  
  53. ul#navmenu .sublvl2 a{
  54. margin-left: 5px;
  55. margin-right: -5px;
  56. }
  57.  
  58. ul#navmenu li:hover > a {
  59. background-color: #CFC;
  60. }
  61.  
  62. ul#navmenu li:hover > a:hover {
  63. background-color: #CC0;
  64. }
  65.  
  66. ul#navmenu ul.sublvl1 {
  67. display: none;
  68. position: relative;
  69. }
  70.  
  71. ul#navmenu ul.sublvl2 {
  72. display: none;
  73. position: absolute;
  74. top: 0;
  75. left: 100px;
  76. }
  77.  
  78. ul#navmenu li:hover .sublvl1 {
  79. display: block;
  80. }
  81.  
  82. ul#navmenu .sublvl1 li:hover .sublvl2 {
  83. display: block;
  84. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.