dropdowns.less 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // DROPDOWN MENUS
  2. // --------------
  3. // Use the .menu class on any <li> element within the topbar or ul.tabs and you'll get some superfancy dropdowns
  4. .dropdown {
  5. position: relative;
  6. }
  7. .dropdown-toggle {
  8. // The caret makes the toggle a bit too tall in IE7
  9. *margin-bottom: -3px;
  10. }
  11. .dropdown-toggle:active,
  12. .open .dropdown-toggle {
  13. outline: 0;
  14. }
  15. // Dropdown arrow/caret
  16. .caret {
  17. display: inline-block;
  18. width: 0;
  19. height: 0;
  20. text-indent: -99999px;
  21. // IE7 won't do the border trick if there's a text indent, but it doesn't
  22. // do the content that text-indent is hiding, either, so we're ok.
  23. *text-indent: 0;
  24. vertical-align: top;
  25. border-left: 4px solid transparent;
  26. border-right: 4px solid transparent;
  27. border-top: 4px solid @black;
  28. .opacity(30);
  29. content: "\2193";
  30. }
  31. .dropdown .caret {
  32. margin-top: 8px;
  33. margin-left: 2px;
  34. }
  35. .dropdown:hover .caret,
  36. .open.dropdown .caret {
  37. .opacity(100);
  38. }
  39. // The dropdown menu (ul)
  40. .dropdown-menu {
  41. position: absolute;
  42. top: 100%;
  43. left: 0;
  44. z-index: @zindexDropdown;
  45. float: left;
  46. display: none; // none by default, but block on "open" of the menu
  47. min-width: 160px;
  48. _width: 160px;
  49. padding: 4px 0;
  50. margin: 0; // override default ul
  51. list-style: none;
  52. background-color: @white;
  53. border-color: #ccc;
  54. border-color: rgba(0,0,0,.2);
  55. border-style: solid;
  56. border-width: 1px;
  57. .border-radius(0 0 5px 5px);
  58. .box-shadow(0 5px 10px rgba(0,0,0,.2));
  59. -webkit-background-clip: padding-box;
  60. -moz-background-clip: padding;
  61. background-clip: padding-box;
  62. *border-right-width: 2px;
  63. *border-bottom-width: 2px;
  64. // Allow for dropdowns to go bottom up (aka, dropup-menu)
  65. &.bottom-up {
  66. top: auto;
  67. bottom: 100%;
  68. margin-bottom: 2px;
  69. }
  70. // Dividers (basically an hr) within the dropdown
  71. .divider {
  72. height: 1px;
  73. margin: 5px 1px;
  74. overflow: hidden;
  75. background-color: #e5e5e5;
  76. border-bottom: 1px solid @white;
  77. // IE7 needs a set width since we gave a height. Restricting just
  78. // to IE7 to keep the 1px left/right space in other browsers.
  79. // It is unclear where IE is getting the extra space that we need
  80. // to negative-margin away, but so it goes.
  81. *width: 100%;
  82. *margin: -5px 0 5px;
  83. }
  84. // Links within the dropdown menu
  85. a {
  86. display: block;
  87. padding: 3px 15px;
  88. clear: both;
  89. font-weight: normal;
  90. line-height: @baseLineHeight;
  91. color: @gray;
  92. white-space: nowrap;
  93. }
  94. }
  95. // Hover state
  96. .dropdown-menu li > a:hover,
  97. .dropdown-menu .active > a,
  98. .dropdown-menu .active > a:hover {
  99. color: @white;
  100. text-decoration: none;
  101. background-color: @linkColor;
  102. }
  103. // Open state for the dropdown
  104. .dropdown.open {
  105. // IE7's z-index only goes to the nearest positioned ancestor, which would
  106. // make the menu appear below buttons that appeared later on the page
  107. *z-index: @zindexDropdown;
  108. .dropdown-toggle {
  109. color: @white;
  110. background: #ccc;
  111. background: rgba(0,0,0,.3);
  112. }
  113. .dropdown-menu {
  114. display: block;
  115. }
  116. }
  117. // Typeahead
  118. .typeahead {
  119. margin-top: 2px; // give it some space to breathe
  120. .border-radius(4px);
  121. }