navbar.less 19 KB

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