navbar.less.svn-base 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. // NAVBAR (FIXED AND STATIC)
  2. // -------------------------
  3. // COMMON STYLES
  4. // -------------
  5. .navbar {
  6. // Fix for IE7's bad z-indexing so dropdowns don't appear below content that follows the navbar
  7. *position: relative;
  8. *z-index: 2;
  9. overflow: visible;
  10. margin-bottom: @baseLineHeight;
  11. }
  12. // Gradient is applied to it's own element because overflow visible is not honored by IE when filter is present
  13. .navbar-inner {
  14. min-height: @navbarHeight;
  15. padding-left: 20px;
  16. padding-right: 20px;
  17. #gradient > .vertical(@navbarBackgroundHighlight, @navbarBackground);
  18. .border-radius(4px);
  19. .box-shadow(~"0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1)");
  20. }
  21. // Set width to auto for default container
  22. // We then reset it for fixed navbars in the #gridSystem mixin
  23. .navbar .container {
  24. width: auto;
  25. }
  26. // Override the default collapsed state
  27. .nav-collapse.collapse {
  28. height: auto;
  29. }
  30. // Brand, links, text, and buttons
  31. .navbar {
  32. color: @navbarText;
  33. // Hover and active states
  34. .brand:hover {
  35. text-decoration: none;
  36. }
  37. // Website or project name
  38. .brand {
  39. float: left;
  40. display: block;
  41. // Vertically center the text given @navbarHeight
  42. @elementHeight: 20px;
  43. padding: ((@navbarHeight - @elementHeight) / 2 - 2) 20px ((@navbarHeight - @elementHeight) / 2 + 2);
  44. margin-left: -20px; // negative indent to left-align the text down the page
  45. font-size: 20px;
  46. font-weight: 200;
  47. line-height: 1;
  48. color: @navbarBrandColor;
  49. }
  50. // Plain text in topbar
  51. .navbar-text {
  52. margin-bottom: 0;
  53. line-height: @navbarHeight;
  54. }
  55. // Janky solution for now to account for links outside the .nav
  56. .navbar-link {
  57. color: @navbarLinkColor;
  58. &:hover {
  59. color: @navbarLinkColorHover;
  60. }
  61. }
  62. // Buttons in navbar
  63. .btn,
  64. .btn-group {
  65. .navbarVerticalAlign(30px); // Vertically center in navbar
  66. }
  67. .btn-group .btn {
  68. margin: 0; // then undo the margin here so we don't accidentally double it
  69. }
  70. }
  71. // Navbar forms
  72. .navbar-form {
  73. margin-bottom: 0; // remove default bottom margin
  74. .clearfix();
  75. input,
  76. select,
  77. .radio,
  78. .checkbox {
  79. .navbarVerticalAlign(30px); // Vertically center in navbar
  80. }
  81. input,
  82. select {
  83. display: inline-block;
  84. margin-bottom: 0;
  85. }
  86. input[type="image"],
  87. input[type="checkbox"],
  88. input[type="radio"] {
  89. margin-top: 3px;
  90. }
  91. .input-append,
  92. .input-prepend {
  93. margin-top: 6px;
  94. white-space: nowrap; // preven two items from separating within a .navbar-form that has .pull-left
  95. input {
  96. margin-top: 0; // remove the margin on top since it's on the parent
  97. }
  98. }
  99. }
  100. // Navbar search
  101. .navbar-search {
  102. position: relative;
  103. float: left;
  104. .navbarVerticalAlign(28px); // Vertically center in navbar
  105. margin-bottom: 0;
  106. .search-query {
  107. padding: 4px 9px;
  108. #font > .sans-serif(13px, normal, 1);
  109. color: @white;
  110. background-color: @navbarSearchBackground;
  111. border: 1px solid @navbarSearchBorder;
  112. .box-shadow(~"inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0px rgba(255,255,255,.15)");
  113. .transition(none);
  114. // Placeholder text gets special styles; can't be a grouped selector
  115. &:-moz-placeholder {
  116. color: @navbarSearchPlaceholderColor;
  117. }
  118. &::-webkit-input-placeholder {
  119. color: @navbarSearchPlaceholderColor;
  120. }
  121. // Focus states (we use .focused since IE7-8 and down doesn't support :focus)
  122. &:focus,
  123. &.focused {
  124. padding: 5px 10px;
  125. color: @grayDark;
  126. text-shadow: 0 1px 0 @white;
  127. background-color: @navbarSearchBackgroundFocus;
  128. border: 0;
  129. .box-shadow(0 0 3px rgba(0,0,0,.15));
  130. outline: 0;
  131. }
  132. }
  133. }
  134. // FIXED NAVBAR
  135. // ------------
  136. // Shared (top/bottom) styles
  137. .navbar-fixed-top,
  138. .navbar-fixed-bottom {
  139. position: fixed;
  140. right: 0;
  141. left: 0;
  142. z-index: @zindexFixedNavbar;
  143. margin-bottom: 0; // remove 18px margin for static navbar
  144. }
  145. .navbar-fixed-top .navbar-inner,
  146. .navbar-fixed-bottom .navbar-inner {
  147. padding-left: 0;
  148. padding-right: 0;
  149. .border-radius(0);
  150. }
  151. .navbar-fixed-top .container,
  152. .navbar-fixed-bottom .container {
  153. #grid > .core > .span(@gridColumns);
  154. }
  155. // Fixed to top
  156. .navbar-fixed-top {
  157. top: 0;
  158. }
  159. // Fixed to bottom
  160. .navbar-fixed-bottom {
  161. bottom: 0;
  162. }
  163. // NAVIGATION
  164. // ----------
  165. .navbar .nav {
  166. position: relative;
  167. left: 0;
  168. display: block;
  169. float: left;
  170. margin: 0 10px 0 0;
  171. }
  172. .navbar .nav.pull-right {
  173. float: right; // redeclare due to specificity
  174. }
  175. .navbar .nav > li {
  176. display: block;
  177. float: left;
  178. }
  179. // Links
  180. .navbar .nav > li > a {
  181. float: none;
  182. // Vertically center the text given @navbarHeight
  183. @elementHeight: 20px;
  184. padding: ((@navbarHeight - @elementHeight) / 2 - 1) 10px ((@navbarHeight - @elementHeight) / 2 + 1);
  185. line-height: 19px;
  186. color: @navbarLinkColor;
  187. text-decoration: none;
  188. text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  189. }
  190. // Buttons
  191. .navbar .btn {
  192. display: inline-block;
  193. padding: 4px 10px 4px;
  194. // Vertically center the button given @navbarHeight
  195. @elementHeight: 28px;
  196. margin: ((@navbarHeight - @elementHeight) / 2 - 1) 5px ((@navbarHeight - @elementHeight) / 2);
  197. line-height: @baseLineHeight;
  198. }
  199. .navbar .btn-group {
  200. margin: 0;
  201. // Vertically center the button given @navbarHeight
  202. @elementHeight: 28px;
  203. padding: ((@navbarHeight - @elementHeight) / 2 - 1) 5px ((@navbarHeight - @elementHeight) / 2);
  204. }
  205. // Hover
  206. .navbar .nav > li > a:hover {
  207. background-color: @navbarLinkBackgroundHover; // "transparent" is default to differentiate :hover from .active
  208. color: @navbarLinkColorHover;
  209. text-decoration: none;
  210. }
  211. // Active nav items
  212. .navbar .nav .active > a,
  213. .navbar .nav .active > a:hover {
  214. color: @navbarLinkColorActive;
  215. text-decoration: none;
  216. background-color: @navbarLinkBackgroundActive;
  217. }
  218. // Dividers (basically a vertical hr)
  219. .navbar .divider-vertical {
  220. height: @navbarHeight;
  221. width: 1px;
  222. margin: 0 9px;
  223. overflow: hidden;
  224. background-color: @navbarBackground;
  225. border-right: 1px solid @navbarBackgroundHighlight;
  226. }
  227. // Secondary (floated right) nav in topbar
  228. .navbar .nav.pull-right {
  229. margin-left: 10px;
  230. margin-right: 0;
  231. }
  232. // Navbar button for toggling navbar items in responsive layouts
  233. // These definitions need to come after '.navbar .btn'
  234. .navbar .btn-navbar {
  235. display: none;
  236. float: right;
  237. padding: 7px 10px;
  238. margin-left: 5px;
  239. margin-right: 5px;
  240. .buttonBackground(@navbarBackgroundHighlight, @navbarBackground);
  241. .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075)");
  242. }
  243. .navbar .btn-navbar .icon-bar {
  244. display: block;
  245. width: 18px;
  246. height: 2px;
  247. background-color: #f5f5f5;
  248. .border-radius(1px);
  249. .box-shadow(0 1px 0 rgba(0,0,0,.25));
  250. }
  251. .btn-navbar .icon-bar + .icon-bar {
  252. margin-top: 3px;
  253. }
  254. // Dropdown menus
  255. // --------------
  256. // Menu position and menu carets
  257. .navbar .dropdown-menu {
  258. &:before {
  259. content: '';
  260. display: inline-block;
  261. border-left: 7px solid transparent;
  262. border-right: 7px solid transparent;
  263. border-bottom: 7px solid #ccc;
  264. border-bottom-color: @dropdownBorder;
  265. position: absolute;
  266. top: -7px;
  267. left: 9px;
  268. }
  269. &:after {
  270. content: '';
  271. display: inline-block;
  272. border-left: 6px solid transparent;
  273. border-right: 6px solid transparent;
  274. border-bottom: 6px solid @dropdownBackground;
  275. position: absolute;
  276. top: -6px;
  277. left: 10px;
  278. }
  279. }
  280. // Menu position and menu caret support for dropups via extra dropup class
  281. .navbar-fixed-bottom .dropdown-menu {
  282. &:before {
  283. border-top: 7px solid #ccc;
  284. border-top-color: @dropdownBorder;
  285. border-bottom: 0;
  286. bottom: -7px;
  287. top: auto;
  288. }
  289. &:after {
  290. border-top: 6px solid @dropdownBackground;
  291. border-bottom: 0;
  292. bottom: -6px;
  293. top: auto;
  294. }
  295. }
  296. // Dropdown toggle caret
  297. .navbar .nav li.dropdown .dropdown-toggle .caret,
  298. .navbar .nav li.dropdown.open .caret {
  299. border-top-color: @white;
  300. border-bottom-color: @white;
  301. }
  302. .navbar .nav li.dropdown.active .caret {
  303. .opacity(100);
  304. }
  305. // Remove background color from open dropdown
  306. .navbar .nav li.dropdown.open > .dropdown-toggle,
  307. .navbar .nav li.dropdown.active > .dropdown-toggle,
  308. .navbar .nav li.dropdown.open.active > .dropdown-toggle {
  309. background-color: transparent;
  310. }
  311. // Dropdown link on hover
  312. .navbar .nav li.dropdown.active > .dropdown-toggle:hover {
  313. color: @white;
  314. }
  315. // Right aligned menus need alt position
  316. // TODO: rejigger this at some point to simplify the selectors
  317. .navbar .pull-right .dropdown-menu,
  318. .navbar .dropdown-menu.pull-right {
  319. left: auto;
  320. right: 0;
  321. &:before {
  322. left: auto;
  323. right: 12px;
  324. }
  325. &:after {
  326. left: auto;
  327. right: 13px;
  328. }
  329. }