navbar.less 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. // NAVBAR (FIXED AND STATIC)
  2. // -------------------------
  3. // COMMON STYLES
  4. // -------------
  5. .navbar {
  6. overflow: visible;
  7. margin-bottom: @baseLineHeight;
  8. }
  9. // Gradient is applied to it's own element because overflow visible is not honored by IE when filter is present
  10. .navbar-inner {
  11. padding-left: 20px;
  12. padding-right: 20px;
  13. #gradient > .vertical(@navbarBackgroundHighlight, @navbarBackground);
  14. .border-radius(4px);
  15. @shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);
  16. .box-shadow(@shadow);
  17. }
  18. // Navbar button for toggling navbar items in responsive layouts
  19. .btn-navbar {
  20. display: none;
  21. float: right;
  22. padding: 7px 10px;
  23. margin-left: 5px;
  24. margin-right: 5px;
  25. .buttonBackground(@navbarBackgroundHighlight, @navbarBackground);
  26. @shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
  27. .box-shadow(@shadow);
  28. }
  29. .btn-navbar .icon-bar {
  30. display: block;
  31. width: 18px;
  32. height: 2px;
  33. background-color: #f5f5f5;
  34. .border-radius(1px);
  35. .box-shadow(0 1px 0 rgba(0,0,0,.25));
  36. }
  37. .btn-navbar .icon-bar + .icon-bar {
  38. margin-top: 3px;
  39. }
  40. // Override the default collapsed state
  41. .nav-collapse.collapse {
  42. height: auto;
  43. }
  44. // Brand, links, text, and buttons
  45. .navbar {
  46. // Hover and active states
  47. .brand:hover {
  48. text-decoration: none;
  49. }
  50. // Website or project name
  51. .brand {
  52. float: left;
  53. display: block;
  54. padding: 8px 20px 12px;
  55. margin-left: -20px; // negative indent to left-align the text down the page
  56. font-size: 20px;
  57. font-weight: 200;
  58. line-height: 1;
  59. color: @white;
  60. }
  61. // Plain text in topbar
  62. .navbar-text {
  63. margin-bottom: 0;
  64. line-height: 40px;
  65. color: @navbarText;
  66. a:hover {
  67. color: @white;
  68. background-color: transparent;
  69. }
  70. }
  71. // Buttons in navbar
  72. .btn,
  73. .btn-group {
  74. margin-top: 5px; // make buttons vertically centered in navbar
  75. }
  76. .btn-group .btn {
  77. margin-top: 0; // then undo the margin here so we don't accidentally double it
  78. }
  79. }
  80. // Navbar forms
  81. .navbar-form {
  82. margin-bottom: 0; // remove default bottom margin
  83. .clearfix();
  84. input,
  85. select {
  86. display: inline-block;
  87. margin-top: 5px;
  88. margin-bottom: 0;
  89. }
  90. .radio,
  91. .checkbox {
  92. margin-top: 5px;
  93. }
  94. input[type="image"],
  95. input[type="checkbox"],
  96. input[type="radio"] {
  97. margin-top: 3px;
  98. }
  99. .input-append,
  100. .input-prepend {
  101. margin-top: 6px;
  102. white-space: nowrap; // preven two items from separating within a .navbar-form that has .pull-left
  103. input {
  104. margin-top: 0; // remove the margin on top since it's on the parent
  105. }
  106. }
  107. }
  108. // Navbar search
  109. .navbar-search {
  110. position: relative;
  111. float: left;
  112. margin-top: 6px;
  113. margin-bottom: 0;
  114. .search-query {
  115. padding: 4px 9px;
  116. #font > .sans-serif(13px, normal, 1);
  117. color: @white;
  118. color: rgba(255,255,255,.75);
  119. background: #666;
  120. background: rgba(255,255,255,.3);
  121. border: 1px solid #111;
  122. @shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0px rgba(255,255,255,.15);
  123. .box-shadow(@shadow);
  124. .transition(none);
  125. // Placeholder text gets special styles; can't be bundled together though for some reason
  126. .placeholder(@grayLighter);
  127. // Hover states
  128. &:hover {
  129. color: @white;
  130. background-color: @grayLight;
  131. background-color: rgba(255,255,255,.5);
  132. }
  133. // Focus states (we use .focused since IE7-8 and down doesn't support :focus)
  134. &:focus,
  135. &.focused {
  136. padding: 5px 10px;
  137. color: @grayDark;
  138. text-shadow: 0 1px 0 @white;
  139. background-color: @white;
  140. border: 0;
  141. .box-shadow(0 0 3px rgba(0,0,0,.15));
  142. outline: 0;
  143. }
  144. }
  145. }
  146. // FIXED NAVBAR
  147. // ------------
  148. .navbar-fixed-top {
  149. position: fixed;
  150. top: 0;
  151. right: 0;
  152. left: 0;
  153. z-index: @zindexFixedNavbar;
  154. }
  155. .navbar-fixed-top .navbar-inner {
  156. padding-left: 0;
  157. padding-right: 0;
  158. .border-radius(0);
  159. }
  160. // NAVIGATION
  161. // ----------
  162. .navbar .nav {
  163. position: relative;
  164. left: 0;
  165. display: block;
  166. float: left;
  167. margin: 0 10px 0 0;
  168. }
  169. .navbar .nav.pull-right {
  170. float: right; // redeclare due to specificity
  171. }
  172. .navbar .nav > li {
  173. display: block;
  174. float: left;
  175. }
  176. // Links
  177. .navbar .nav > li > a {
  178. float: none;
  179. padding: 10px 10px 11px;
  180. line-height: 19px;
  181. color: @navbarLinkColor;
  182. text-decoration: none;
  183. text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  184. }
  185. // Hover
  186. .navbar .nav > li > a:hover {
  187. background-color: @navbarLinkBackgroundHover; // "transparent" is default to differentiate :hover from .active
  188. color: @navbarLinkColorHover;
  189. text-decoration: none;
  190. }
  191. // Active nav items
  192. .navbar .nav .active > a,
  193. .navbar .nav .active > a:hover {
  194. color: @navbarLinkColorHover;
  195. text-decoration: none;
  196. background-color: @navbarBackground;
  197. }
  198. // Dividers (basically a vertical hr)
  199. .navbar .divider-vertical {
  200. height: @navbarHeight;
  201. width: 1px;
  202. margin: 0 9px;
  203. overflow: hidden;
  204. background-color: @navbarBackground;
  205. border-right: 1px solid @navbarBackgroundHighlight;
  206. }
  207. // Secondary (floated right) nav in topbar
  208. .navbar .nav.pull-right {
  209. margin-left: 10px;
  210. margin-right: 0;
  211. }
  212. // Dropdown menus
  213. // --------------
  214. // Menu position and menu carets
  215. .navbar .dropdown-menu {
  216. margin-top: 1px;
  217. .border-radius(4px);
  218. &:before {
  219. content: '';
  220. display: inline-block;
  221. border-left: 7px solid transparent;
  222. border-right: 7px solid transparent;
  223. border-bottom: 7px solid #ccc;
  224. border-bottom-color: rgba(0,0,0,.2);
  225. position: absolute;
  226. top: -7px;
  227. left: 9px;
  228. }
  229. &:after {
  230. content: '';
  231. display: inline-block;
  232. border-left: 6px solid transparent;
  233. border-right: 6px solid transparent;
  234. border-bottom: 6px solid @white;
  235. position: absolute;
  236. top: -6px;
  237. left: 10px;
  238. }
  239. }
  240. // Dropdown toggle caret
  241. .navbar .nav .dropdown-toggle .caret,
  242. .navbar .nav .open.dropdown .caret {
  243. border-top-color: @white;
  244. }
  245. .navbar .nav .active .caret {
  246. .opacity(100);
  247. }
  248. // Remove background color from open dropdown
  249. .navbar .nav .open > .dropdown-toggle,
  250. .navbar .nav .active > .dropdown-toggle,
  251. .navbar .nav .open.active > .dropdown-toggle {
  252. background-color: transparent;
  253. }
  254. // Dropdown link on hover
  255. .navbar .nav .active > .dropdown-toggle:hover {
  256. color: @white;
  257. }
  258. // Right aligned menus need alt position
  259. .navbar .nav.pull-right .dropdown-menu {
  260. left: auto;
  261. right: 0;
  262. &:before {
  263. left: auto;
  264. right: 12px;
  265. }
  266. &:after {
  267. left: auto;
  268. right: 13px;
  269. }
  270. }