You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

422 lines
9.2 KiB

10 years ago
  1. //
  2. // Navbars
  3. // --------------------------------------------------
  4. // Wrapper and base class
  5. //
  6. // Provide a static navbar from which we expand to create full-width, fixed, and
  7. // other navbar variations.
  8. .navbar {
  9. position: relative;
  10. min-height: @navbar-height; // Ensure a navbar always shows (e.g., without a .navbar-brand in collapsed mode)
  11. margin-bottom: @navbar-margin-bottom;
  12. border: 1px solid transparent;
  13. // Prevent floats from breaking the navbar
  14. &:extend(.clearfix all);
  15. @media (min-width: @grid-float-breakpoint) {
  16. border-radius: @navbar-border-radius;
  17. }
  18. }
  19. // Navbar heading
  20. //
  21. // Groups `.navbar-brand` and `.navbar-toggle` into a single component for easy
  22. // styling of responsive aspects.
  23. .navbar-header {
  24. &:extend(.clearfix all);
  25. @media (min-width: @grid-float-breakpoint) {
  26. float: left;
  27. }
  28. }
  29. // Navbar collapse (body)
  30. //
  31. // Group your navbar content into this for easy collapsing and expanding across
  32. // various device sizes. By default, this content is collapsed when <768px, but
  33. // will expand past that for a horizontal display.
  34. //
  35. // To start (on mobile devices) the navbar links, forms, and buttons are stacked
  36. // vertically and include a `max-height` to overflow in case you have too much
  37. // content for the user's viewport.
  38. .navbar-collapse {
  39. overflow-x: visible;
  40. padding-right: @navbar-padding-horizontal;
  41. padding-left: @navbar-padding-horizontal;
  42. border-top: 1px solid transparent;
  43. box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
  44. &:extend(.clearfix all);
  45. -webkit-overflow-scrolling: touch;
  46. &.in {
  47. overflow-y: auto;
  48. }
  49. @media (min-width: @grid-float-breakpoint) {
  50. width: auto;
  51. border-top: 0;
  52. box-shadow: none;
  53. &.collapse {
  54. display: block !important;
  55. height: auto !important;
  56. padding-bottom: 0; // Override default setting
  57. overflow: visible !important;
  58. }
  59. &.in {
  60. overflow-y: visible;
  61. }
  62. // Undo the collapse side padding for navbars with containers to ensure
  63. // alignment of right-aligned contents.
  64. .navbar-fixed-top &,
  65. .navbar-static-top &,
  66. .navbar-fixed-bottom & {
  67. padding-left: 0;
  68. padding-right: 0;
  69. }
  70. }
  71. }
  72. // Both navbar header and collapse
  73. //
  74. // When a container is present, change the behavior of the header and collapse.
  75. .container,
  76. .container-fluid {
  77. > .navbar-header,
  78. > .navbar-collapse {
  79. margin-right: -@navbar-padding-horizontal;
  80. margin-left: -@navbar-padding-horizontal;
  81. @media (min-width: @grid-float-breakpoint) {
  82. margin-right: 0;
  83. margin-left: 0;
  84. }
  85. }
  86. }
  87. // Brand/project name
  88. .navbar-brand {
  89. float: left;
  90. padding: @navbar-padding-vertical @navbar-padding-horizontal;
  91. font-size: @font-size-large;
  92. line-height: @line-height-computed;
  93. height: @navbar-height;
  94. &:hover,
  95. &:focus {
  96. text-decoration: none;
  97. }
  98. > img {
  99. display: block;
  100. }
  101. @media (min-width: @grid-float-breakpoint) {
  102. .navbar > .container &,
  103. .navbar > .container-fluid & {
  104. margin-left: -@navbar-padding-horizontal;
  105. }
  106. }
  107. }
  108. // Navbar toggle
  109. //
  110. // Custom button for toggling the `.navbar-collapse`, powered by the collapse
  111. // JavaScript plugin.
  112. .navbar-toggle {
  113. position: relative;
  114. float: right;
  115. margin-right: @navbar-padding-horizontal;
  116. padding: 9px 10px;
  117. .navbar-vertical-align(34px);
  118. background-color: transparent;
  119. background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
  120. border: 1px solid transparent;
  121. border-radius: @border-radius-base;
  122. // We remove the `outline` here, but later compensate by attaching `:hover`
  123. // styles to `:focus`.
  124. &:focus {
  125. outline: 0;
  126. }
  127. // Bars
  128. .icon-bar {
  129. display: block;
  130. width: 22px;
  131. height: 2px;
  132. border-radius: 1px;
  133. }
  134. .icon-bar + .icon-bar {
  135. margin-top: 4px;
  136. }
  137. @media (min-width: @grid-float-breakpoint) {
  138. display: none;
  139. }
  140. }
  141. // Navbar nav links
  142. //
  143. // Builds on top of the `.nav` components with its own modifier class to make
  144. // the nav the full height of the horizontal nav (above 768px).
  145. .navbar-nav {
  146. margin: (@navbar-padding-vertical / 2) -@navbar-padding-horizontal;
  147. > li > a {
  148. padding-top: 10px;
  149. padding-bottom: 10px;
  150. line-height: @line-height-computed;
  151. }
  152. @media (max-width: @grid-float-breakpoint-max) {
  153. // Dropdowns get custom display when collapsed
  154. .open .dropdown-menu {
  155. position: static;
  156. float: none;
  157. width: auto;
  158. margin-top: 0;
  159. background-color: transparent;
  160. border: 0;
  161. box-shadow: none;
  162. > li > a,
  163. .dropdown-header {
  164. padding: 5px 15px 5px 25px;
  165. }
  166. > li > a {
  167. line-height: @line-height-computed;
  168. &:hover,
  169. &:focus {
  170. background-image: none;
  171. }
  172. }
  173. }
  174. }
  175. // Uncollapse the nav
  176. @media (min-width: @grid-float-breakpoint) {
  177. float: left;
  178. margin: 0;
  179. > li {
  180. float: left;
  181. > a {
  182. padding-top: @navbar-padding-vertical;
  183. padding-bottom: @navbar-padding-vertical;
  184. }
  185. }
  186. }
  187. }
  188. // Dropdown menus
  189. // Menu position and menu carets
  190. .navbar-nav > li > .dropdown-menu {
  191. margin-top: 0;
  192. .border-top-radius(0);
  193. }
  194. // Buttons in navbars
  195. //
  196. // Vertically center a button within a navbar (when *not* in a form).
  197. .navbar-btn {
  198. .navbar-vertical-align(@input-height-base);
  199. &.btn-sm {
  200. .navbar-vertical-align(@input-height-small);
  201. }
  202. &.btn-xs {
  203. .navbar-vertical-align(22);
  204. }
  205. }
  206. // Text in navbars
  207. //
  208. // Add a class to make any element properly align itself vertically within the navbars.
  209. .navbar-text {
  210. .navbar-vertical-align(@line-height-computed);
  211. @media (min-width: @grid-float-breakpoint) {
  212. float: left;
  213. margin-left: @navbar-padding-horizontal;
  214. margin-right: @navbar-padding-horizontal;
  215. }
  216. }
  217. // Component alignment
  218. //
  219. // Repurpose the pull utilities as their own navbar utilities to avoid specificity
  220. // issues with parents and chaining. Only do this when the navbar is uncollapsed
  221. // though so that navbar contents properly stack and align in mobile.
  222. //
  223. // Declared after the navbar components to ensure more specificity on the margins.
  224. @media (min-width: @grid-float-breakpoint) {
  225. .navbar-left { .pull-left(); }
  226. .navbar-right {
  227. .pull-right();
  228. margin-right: -@navbar-padding-horizontal;
  229. ~ .navbar-right {
  230. margin-right: 0;
  231. }
  232. }
  233. }
  234. // Alternate navbars
  235. // --------------------------------------------------
  236. // Default navbar
  237. .navbar-default {
  238. background-color: @navbar-default-bg;
  239. border-color: @navbar-default-border;
  240. .navbar-brand {
  241. color: @navbar-default-brand-color;
  242. &:hover,
  243. &:focus {
  244. color: @navbar-default-brand-hover-color;
  245. background-color: @navbar-default-brand-hover-bg;
  246. }
  247. }
  248. .navbar-text {
  249. color: @navbar-default-color;
  250. }
  251. .navbar-nav {
  252. > li > a {
  253. color: @navbar-default-link-color;
  254. &:hover,
  255. &:focus {
  256. color: @navbar-default-link-hover-color;
  257. background-color: @navbar-default-link-hover-bg;
  258. }
  259. }
  260. > .active > a {
  261. &,
  262. &:hover,
  263. &:focus {
  264. color: @navbar-default-link-active-color;
  265. background-color: @navbar-default-link-active-bg;
  266. }
  267. }
  268. > .disabled > a {
  269. &,
  270. &:hover,
  271. &:focus {
  272. color: @navbar-default-link-disabled-color;
  273. background-color: @navbar-default-link-disabled-bg;
  274. }
  275. }
  276. }
  277. .navbar-toggle {
  278. border-color: @navbar-default-toggle-border-color;
  279. &:hover,
  280. &:focus {
  281. background-color: @navbar-default-toggle-hover-bg;
  282. }
  283. .icon-bar {
  284. background-color: @navbar-default-toggle-icon-bar-bg;
  285. }
  286. }
  287. .navbar-collapse,
  288. .navbar-form {
  289. border-color: @navbar-default-border;
  290. }
  291. // Dropdown menu items
  292. .navbar-nav {
  293. // Remove background color from open dropdown
  294. > .open > a {
  295. &,
  296. &:hover,
  297. &:focus {
  298. background-color: @navbar-default-link-active-bg;
  299. color: @navbar-default-link-active-color;
  300. }
  301. }
  302. @media (max-width: @grid-float-breakpoint-max) {
  303. // Dropdowns get custom display when collapsed
  304. .open .dropdown-menu {
  305. > li > a {
  306. color: @navbar-default-link-color;
  307. &:hover,
  308. &:focus {
  309. color: @navbar-default-link-hover-color;
  310. background-color: @navbar-default-link-hover-bg;
  311. }
  312. }
  313. > .active > a {
  314. &,
  315. &:hover,
  316. &:focus {
  317. color: @navbar-default-link-active-color;
  318. background-color: @navbar-default-link-active-bg;
  319. }
  320. }
  321. > .disabled > a {
  322. &,
  323. &:hover,
  324. &:focus {
  325. color: @navbar-default-link-disabled-color;
  326. background-color: @navbar-default-link-disabled-bg;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. // Links in navbars
  333. //
  334. // Add a class to ensure links outside the navbar nav are colored correctly.
  335. .navbar-link {
  336. color: @navbar-default-link-color;
  337. &:hover {
  338. color: @navbar-default-link-hover-color;
  339. }
  340. }
  341. .btn-link {
  342. color: @navbar-default-link-color;
  343. &:hover,
  344. &:focus {
  345. color: @navbar-default-link-hover-color;
  346. }
  347. &[disabled],
  348. fieldset[disabled] & {
  349. &:hover,
  350. &:focus {
  351. color: @navbar-default-link-disabled-color;
  352. }
  353. }
  354. }
  355. }