navbar.less 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  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-bottom: 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. &:extend(.clearfix all);
  43. -webkit-overflow-scrolling: touch;
  44. height: 100vh;
  45. &.in {
  46. overflow-y: auto;
  47. }
  48. @media (min-width: @grid-float-breakpoint) {
  49. width: auto;
  50. border-top: 0;
  51. box-shadow: none;
  52. &.collapse {
  53. display: block !important;
  54. height: auto !important;
  55. padding-bottom: 0; // Override default setting
  56. overflow: visible !important;
  57. }
  58. &.in {
  59. overflow-y: visible;
  60. }
  61. // Undo the collapse side padding for navbars with containers to ensure
  62. // alignment of right-aligned contents.
  63. .navbar-fixed-top &,
  64. .navbar-static-top &,
  65. .navbar-fixed-bottom & {
  66. padding-left: 0;
  67. padding-right: 0;
  68. }
  69. }
  70. }
  71. .navbar-main {
  72. z-index: @z-index-navbar;
  73. .container-fluid > .navbar-collapse {
  74. // High specificity needed to override Bootstrap's default.
  75. margin: 10px 0 0;
  76. @media (min-width: @grid-float-breakpoint) {
  77. margin: 0;
  78. }
  79. }
  80. .navbar-collapse {
  81. // Use absolute positioning to build the hamburger menu.
  82. position: absolute;
  83. left: 0;
  84. width: 100%;
  85. margin: 0;
  86. background-color: @navbar-default-bg;
  87. border-bottom: solid 1px @navbar-default-border;
  88. padding: 0;
  89. @media (min-width: @grid-float-breakpoint) {
  90. // Get back to regular layout mode as soon as the menu items are
  91. // expanded (i.e. not contained within the hamburguer menu).
  92. position: static;
  93. background-color: transparent;
  94. border-bottom: 0;
  95. padding-right: @navbar-padding-horizontal;
  96. padding-left: @navbar-padding-horizontal;
  97. }
  98. }
  99. }
  100. // Both navbar header and collapse
  101. //
  102. // When a container is present, change the behavior of the header and collapse.
  103. .container,
  104. .container-fluid {
  105. > .navbar-header,
  106. > .navbar-collapse {
  107. margin-right: -@navbar-padding-horizontal;
  108. margin-left: -@navbar-padding-horizontal;
  109. @media (min-width: @grid-float-breakpoint) {
  110. margin-right: 0;
  111. margin-left: 0;
  112. }
  113. }
  114. }
  115. //
  116. // Navbar alignment options
  117. //
  118. // Display the navbar across the entirety of the page or fixed it to the top or
  119. // bottom of the page.
  120. // Static top (unfixed, but 100% wide) navbar
  121. .navbar-static-top {
  122. z-index: @zindex-navbar;
  123. border-width: 0 0 1px;
  124. @media (min-width: @grid-float-breakpoint) {
  125. border-radius: 0;
  126. }
  127. }
  128. // Fix the top/bottom navbars when screen real estate supports it
  129. .navbar-fixed-top,
  130. .navbar-fixed-bottom {
  131. position: fixed;
  132. right: 0;
  133. left: 0;
  134. z-index: @zindex-navbar-fixed;
  135. // Undo the rounded corners
  136. @media (min-width: @grid-float-breakpoint) {
  137. border-radius: 0;
  138. }
  139. }
  140. .navbar-fixed-top {
  141. top: 0;
  142. border-width: 0 0 1px;
  143. }
  144. .navbar-fixed-bottom {
  145. bottom: 0;
  146. margin-bottom: 0; // override .navbar defaults
  147. border-width: 1px 0 0;
  148. }
  149. // Brand/project name
  150. .navbar-brand {
  151. float: left;
  152. //padding: @navbar-padding-vertical @navbar-padding-horizontal;
  153. //font-size: @font-size-large;
  154. line-height: @line-height-computed;
  155. //height: @navbar-height;
  156. &:hover,
  157. &:focus {
  158. text-decoration: none;
  159. }
  160. // @media (min-width: @grid-float-breakpoint) {
  161. // .navbar > .container &,
  162. // .navbar > .container-fluid & {
  163. // margin-left: -@navbar-padding-horizontal;
  164. // }
  165. // }
  166. }
  167. .navbar-title {
  168. font-size: 20px;
  169. display: inline-block;
  170. margin-top: 2px;
  171. color: @navbar-title-color;
  172. &:hover,
  173. &:active,
  174. &:focus {
  175. color: @navbar-title-color-hover;
  176. text-decoration: none;
  177. }
  178. }
  179. // Navbar toggle
  180. //
  181. // Custom button for toggling the `.navbar-collapse`, powered by the collapse
  182. // JavaScript plugin.
  183. .navbar-toggle {
  184. position: relative;
  185. float: right;
  186. padding: 3px 10px 0px;
  187. background-color: transparent;
  188. background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
  189. border: 0;
  190. border-radius: @border-radius-base;
  191. .fa {
  192. font-size: @navbar-height / 2;
  193. }
  194. // We remove the `outline` here, but later compensate by attaching `:hover`
  195. // styles to `:focus`.
  196. &:focus {
  197. outline: none;
  198. }
  199. @media (min-width: @grid-float-breakpoint) {
  200. display: none;
  201. }
  202. }
  203. // Navbar nav links
  204. //
  205. // Builds on top of the `.nav` components with its own modifier class to make
  206. // the nav the full height of the horizontal nav (above 768px).
  207. .navbar-nav {
  208. margin: (@navbar-padding-vertical / 2) -@navbar-padding-horizontal;
  209. > li > a {
  210. padding-top: 10px;
  211. padding-bottom: 10px;
  212. line-height: @line-height-computed;
  213. }
  214. @media (max-width: @grid-float-breakpoint-max) {
  215. margin: (@navbar-padding-vertical / 2) 0;
  216. // Dropdowns get custom display when collapsed
  217. .open .dropdown-menu {
  218. position: static;
  219. float: none;
  220. width: auto;
  221. margin-top: 0;
  222. background-color: transparent;
  223. border: 0;
  224. box-shadow: none;
  225. > li > a,
  226. > li > div.subdued,
  227. > li > form > button,
  228. .dropdown-header {
  229. padding: 5px 15px 5px 25px;
  230. }
  231. > li > a,
  232. > li > form > button {
  233. line-height: @line-height-computed;
  234. &:hover,
  235. &:focus {
  236. background-image: none;
  237. }
  238. }
  239. > li > div.subdued {
  240. line-height: @line-height-computed;
  241. }
  242. }
  243. }
  244. // Uncollapse the nav
  245. @media (min-width: @grid-float-breakpoint) {
  246. float: left;
  247. margin: 0;
  248. > li {
  249. float: left;
  250. > a {
  251. padding-top: @navbar-padding-vertical;
  252. padding-bottom: @navbar-padding-vertical;
  253. }
  254. }
  255. &.navbar-right:last-child {
  256. margin-right: -@navbar-padding-horizontal;
  257. }
  258. }
  259. }
  260. // Component alignment
  261. //
  262. // Repurpose the pull utilities as their own navbar utilities to avoid specificity
  263. // issues with parents and chaining. Only do this when the navbar is uncollapsed
  264. // though so that navbar contents properly stack and align in mobile.
  265. @media (min-width: @grid-float-breakpoint) {
  266. .navbar-left {
  267. .pull-left();
  268. }
  269. .navbar-right {
  270. .pull-right();
  271. }
  272. }
  273. // Navbar form
  274. //
  275. // Extension of the `.form-inline` with some extra flavor for optimum display in
  276. // our navbars.
  277. .navbar-form {
  278. margin-left: -@navbar-padding-horizontal;
  279. margin-right: -@navbar-padding-horizontal;
  280. padding: 10px @navbar-padding-horizontal;
  281. border-top: 1px solid transparent;
  282. border-bottom: 1px solid transparent;
  283. @shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
  284. 0 1px 0 rgba(255, 255, 255, 0.1);
  285. .box-shadow(@shadow);
  286. // Mixin behavior for optimum display
  287. .form-inline();
  288. .form-group {
  289. @media (max-width: @grid-float-breakpoint-max) {
  290. margin-bottom: 5px;
  291. }
  292. }
  293. // Vertically center in expanded, horizontal navbar
  294. .navbar-vertical-align(@input-height-base);
  295. // Undo 100% width for pull classes
  296. @media (min-width: @grid-float-breakpoint) {
  297. width: auto;
  298. border: 0;
  299. margin-left: 0;
  300. margin-right: 0;
  301. padding-top: 0;
  302. padding-bottom: 0;
  303. .box-shadow(none);
  304. // Outdent the form if last child to line up with content down the page
  305. &.navbar-right:last-child {
  306. margin-right: -@navbar-padding-horizontal;
  307. }
  308. }
  309. }
  310. // Dropdown menus
  311. // Menu position and menu carets
  312. .navbar-nav > li > .dropdown-menu {
  313. margin-top: 0;
  314. .border-top-radius(0);
  315. }
  316. // Menu position and menu caret support for dropups via extra dropup class
  317. .navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
  318. .border-bottom-radius(0);
  319. }
  320. // Buttons in navbars
  321. //
  322. // Vertically center a button within a navbar (when *not* in a form).
  323. .navbar-btn {
  324. .navbar-vertical-align(@input-height-base);
  325. &.btn-sm {
  326. .navbar-vertical-align(@input-height-small);
  327. }
  328. &.btn-xs {
  329. .navbar-vertical-align(22);
  330. }
  331. }
  332. // Text in navbars
  333. //
  334. // Add a class to make any element properly align itself vertically within the navbars.
  335. .navbar-text {
  336. .navbar-vertical-align(@line-height-computed);
  337. @media (min-width: @grid-float-breakpoint) {
  338. float: left;
  339. margin-left: @navbar-padding-horizontal;
  340. margin-right: @navbar-padding-horizontal;
  341. // Outdent the form if last child to line up with content down the page
  342. &.navbar-right:last-child {
  343. margin-right: 0;
  344. }
  345. }
  346. }
  347. // Alternate navbars
  348. // --------------------------------------------------
  349. // Default navbar
  350. .navbar-default {
  351. background-color: @navbar-default-bg;
  352. border-color: @navbar-default-border;
  353. padding: @navbar-default-padding;
  354. position: absolute;
  355. top: 0;
  356. width: 100%;
  357. height: @header-height;
  358. .navbar-brand {
  359. position: absolute;
  360. top: 5px;
  361. bottom: 5px;
  362. width: @navbar-brand-width;
  363. padding: 0;
  364. background-image: @navbar-brand-image-url;
  365. background-size: contain;
  366. background-repeat: no-repeat;
  367. background-position: left center;
  368. }
  369. .navbar-text {
  370. color: @navbar-default-color;
  371. }
  372. .navbar-nav {
  373. > li > a {
  374. color: @navbar-default-link-color;
  375. border: 2px solid transparent;
  376. font-size: @navbar-btn-font-size;
  377. font-weight: @navbar-btn-font-weight;
  378. line-height: @navbar-btn-line-height;
  379. background-color: @navbar-default-link-bg;
  380. @media (min-width: @grid-float-breakpoint) {
  381. border-radius: @navbar-btn-border-radius;
  382. padding: @navbar-btn-padding;
  383. }
  384. &:hover,
  385. &:focus {
  386. color: #fff;
  387. background-color: @navbar-default-link-hover-bg;
  388. border: 2px solid @navbar-default-link-hover-color;
  389. }
  390. }
  391. > .active > a {
  392. &,
  393. &:hover,
  394. &:focus {
  395. color: @navbar-default-link-active-color;
  396. background-color: @navbar-default-link-active-bg;
  397. }
  398. }
  399. > .disabled > a {
  400. &,
  401. &:hover,
  402. &:focus {
  403. color: @navbar-default-link-disabled-color;
  404. background-color: @navbar-default-link-disabled-bg;
  405. }
  406. }
  407. > li.subdued > a {
  408. border: 0;
  409. color: @navbar-subdued-color;
  410. margin-left: 0;
  411. background-color: transparent;
  412. &:hover,
  413. &:focus {
  414. color: @navbar-subdued-hover-color;
  415. background-color: @navbar-subdued-hover-bg;
  416. }
  417. &:focus {
  418. .tab-focus();
  419. }
  420. @media (min-width: @grid-float-breakpoint) {
  421. padding: @navbar-subdued-padding;
  422. }
  423. }
  424. > li.primary > a {
  425. .btn-borderless();
  426. }
  427. > li.secondary > a {
  428. .btn-bordered();
  429. border-width: @border-radius-small;
  430. }
  431. @media (min-width: @grid-float-breakpoint) {
  432. > li > a {
  433. border-color: @navbar-default-link-border-color;
  434. margin-left: 1rem;
  435. }
  436. }
  437. }
  438. .navbar-toggle {
  439. border-color: @navbar-default-toggle-border-color;
  440. color: @navbar-default-link-color;
  441. &:hover,
  442. &.active {
  443. background-color: @navbar-default-toggle-hover-bg;
  444. border-color: @navbar-default-toggle-hover-bg;
  445. color: #fff;
  446. }
  447. }
  448. .navbar-collapse,
  449. .navbar-form {
  450. border-color: @navbar-default-border;
  451. }
  452. .navbar-collapse.in {
  453. box-shadow: 0 10px 15px rgba(0, 0, 0, 0.25);
  454. }
  455. // Dropdown menu items
  456. .navbar-nav {
  457. // Remove background color from open dropdown
  458. > .open > a {
  459. &,
  460. &:hover,
  461. &:focus {
  462. background-color: @navbar-default-link-active-bg;
  463. color: @navbar-default-link-active-color;
  464. }
  465. }
  466. > .open.subdued > a {
  467. &,
  468. &:hover,
  469. &:focus {
  470. color: @navbar-subdued-hover-color;
  471. background-color: @navbar-subdued-hover-bg;
  472. }
  473. }
  474. @media (max-width: @grid-float-breakpoint-max) {
  475. // Dropdowns get custom display when collapsed
  476. .open .dropdown-menu {
  477. background-color: lighten(@navbar-default-bg, 10%);
  478. > li > div.subdued {
  479. color: mix(@navbar-default-link-color, @navbar-default-bg);
  480. }
  481. > li > a,
  482. > li > form > button {
  483. // padding: 12px 12px 13px 30px;
  484. color: @navbar-default-link-color;
  485. &:hover,
  486. &:focus {
  487. color: #fff;
  488. background-color: @navbar-default-link-hover-bg;
  489. }
  490. }
  491. > .active > a,
  492. > .active > form > button {
  493. &,
  494. &:hover,
  495. &:focus {
  496. color: @navbar-default-link-active-color;
  497. background-color: @navbar-default-link-active-bg;
  498. }
  499. }
  500. > .disabled > a,
  501. > .disabled > form > button {
  502. &,
  503. &:hover,
  504. &:focus {
  505. color: @navbar-default-link-disabled-color;
  506. background-color: @navbar-default-link-disabled-bg;
  507. }
  508. }
  509. }
  510. }
  511. }
  512. // Links in navbars
  513. //
  514. // Add a class to ensure links outside the navbar nav are colored correctly.
  515. .navbar-link {
  516. color: @navbar-default-link-color;
  517. &:hover {
  518. color: @navbar-default-link-hover-color;
  519. }
  520. }
  521. @media (min-width: @grid-float-breakpoint) {
  522. padding: @navbar-default-padding-v 0;
  523. }
  524. }
  525. // Accessibility
  526. .skip-to-content {
  527. color: @navbar-default-link-color;
  528. background-color: @navbar-default-link-bg;
  529. border: 2px solid transparent;
  530. border-radius: @navbar-btn-border-radius;
  531. font-size: @navbar-btn-font-size;
  532. font-weight: @navbar-btn-font-weight;
  533. left: @navbar-brand-width + @padding-lg;
  534. line-height: @navbar-btn-line-height;
  535. padding: @navbar-btn-padding;
  536. position: absolute;
  537. top: -200px;
  538. z-index: @zindex-navbar + 1;
  539. &:focus {
  540. background-color: @navbar-default-link-hover-bg;
  541. border: 2px solid @navbar-default-link-hover-color;
  542. color: @white;
  543. text-decoration: none;
  544. top: @navbar-default-padding-v;
  545. }
  546. }
  547. .website-redesign-navbar {
  548. &.navbar-default {
  549. background-color: @navbar-default-bg-website-redesign;
  550. .navbar-brand {
  551. background-image: @navbar-brand-image-url-website-redesign;
  552. }
  553. .navbar-text {
  554. color: @navbar-default-color-website-redesign;
  555. }
  556. // There is this -15px margin hack that is needed on the original
  557. // This causes inconsistency with the website redesign navbar,
  558. // so reset it to 0 for now
  559. @media (min-width: @grid-float-breakpoint) {
  560. .navbar-right:last-child {
  561. margin-right: 0;
  562. }
  563. }
  564. .navbar-nav {
  565. > li > a {
  566. color: @navbar-default-link-color-website-redesign;
  567. // border: 2px solid transparent;
  568. @media (min-width: @grid-float-breakpoint) {
  569. border-radius: @navbar-btn-border-radius;
  570. padding: @navbar-btn-padding;
  571. }
  572. }
  573. > li.subdued > a {
  574. color: @navbar-subdued-color-website-redesign;
  575. &:hover,
  576. &:focus {
  577. color: @navbar-subdued-hover-color-website-redesign;
  578. background-color: @navbar-subdued-hover-bg-website-redesign;
  579. }
  580. &:focus {
  581. .tab-focus();
  582. }
  583. @media (min-width: @grid-float-breakpoint) {
  584. padding: @navbar-subdued-padding;
  585. }
  586. }
  587. > li.primary > a {
  588. .btn-borderless();
  589. }
  590. > li.secondary > a {
  591. .btn-bordered();
  592. border-width: @border-radius-small;
  593. border-color: transparent;
  594. @media (min-width: @grid-float-breakpoint) {
  595. border-color: @btn-bordered-border-color;
  596. }
  597. }
  598. }
  599. .navbar-toggle {
  600. border-color: @navbar-default-toggle-border-color-website-redesign;
  601. color: @navbar-default-link-color-website-redesign;
  602. &:hover,
  603. &.active {
  604. background-color: @navbar-default-toggle-hover-bg-website-redesign;
  605. border-color: @navbar-default-toggle-hover-bg-website-redesign;
  606. color: #fff;
  607. }
  608. }
  609. .navbar-collapse {
  610. // Use absolute positioning to build the hamburger menu.
  611. background-color: @navbar-default-bg-website-redesign;
  612. border-bottom: solid 1px @navbar-default-border;
  613. }
  614. // Dropdown menu items
  615. .navbar-nav {
  616. .dropdown-menu-button,
  617. .dropdown-menu > li > a {
  618. &:hover,
  619. &:focus {
  620. background-color: @navbar-default-link-active-bg-website-redesign;
  621. }
  622. }
  623. // Remove background color from open dropdown
  624. > .open > a {
  625. &,
  626. &:hover,
  627. &:focus {
  628. background-color: @btn-secondary-hover-bg-color; // force secondary button style
  629. color: @navbar-default-link-active-color-website-redesign;
  630. }
  631. }
  632. > .open.subdued > a {
  633. &,
  634. &:hover,
  635. &:focus {
  636. color: @navbar-subdued-hover-color-website-redesign;
  637. background-color: @navbar-subdued-hover-bg-website-redesign;
  638. }
  639. }
  640. @media (max-width: @grid-float-breakpoint-max) {
  641. // Dropdowns get custom display when collapsed
  642. .open .dropdown-menu {
  643. background-color: darken(@navbar-default-bg-website-redesign, 5%);
  644. > li > div.subdued {
  645. color: mix(
  646. @navbar-default-link-color-website-redesign,
  647. @navbar-default-bg-website-redesign
  648. );
  649. }
  650. > li > a,
  651. > li > form > button {
  652. // padding: 12px 12px 13px 30px;
  653. color: @navbar-default-link-color-website-redesign;
  654. &:hover,
  655. &:focus {
  656. color: #fff;
  657. background-color: @navbar-default-link-hover-bg-website-redesign;
  658. }
  659. }
  660. > .active > a,
  661. > .active > form > button {
  662. &,
  663. &:hover,
  664. &:focus {
  665. color: @navbar-default-link-active-color-website-redesign;
  666. background-color: @navbar-default-link-active-bg-website-redesign;
  667. }
  668. }
  669. > .disabled > a,
  670. > .disabled > form > button {
  671. &,
  672. &:hover,
  673. &:focus {
  674. color: @navbar-default-link-disabled-color-website-redesign;
  675. background-color: @navbar-default-link-disabled-bg;
  676. }
  677. }
  678. }
  679. }
  680. }
  681. }
  682. }