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.

414 lines
9.1 KiB

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