navbar.less 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  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:
  284. inset 0 1px 0 rgba(255, 255, 255, 0.1),
  285. 0 1px 0 rgba(255, 255, 255, 0.1);
  286. .box-shadow(@shadow);
  287. // Mixin behavior for optimum display
  288. .form-inline();
  289. .form-group {
  290. @media (max-width: @grid-float-breakpoint-max) {
  291. margin-bottom: 5px;
  292. }
  293. }
  294. // Vertically center in expanded, horizontal navbar
  295. .navbar-vertical-align(@input-height-base);
  296. // Undo 100% width for pull classes
  297. @media (min-width: @grid-float-breakpoint) {
  298. width: auto;
  299. border: 0;
  300. margin-left: 0;
  301. margin-right: 0;
  302. padding-top: 0;
  303. padding-bottom: 0;
  304. .box-shadow(none);
  305. // Outdent the form if last child to line up with content down the page
  306. &.navbar-right:last-child {
  307. margin-right: -@navbar-padding-horizontal;
  308. }
  309. }
  310. }
  311. // Dropdown menus
  312. // Menu position and menu carets
  313. .navbar-nav > li > .dropdown-menu {
  314. margin-top: 0;
  315. .border-top-radius(0);
  316. }
  317. // Menu position and menu caret support for dropups via extra dropup class
  318. .navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
  319. .border-bottom-radius(0);
  320. }
  321. // Buttons in navbars
  322. //
  323. // Vertically center a button within a navbar (when *not* in a form).
  324. .navbar-btn {
  325. .navbar-vertical-align(@input-height-base);
  326. &.btn-sm {
  327. .navbar-vertical-align(@input-height-small);
  328. }
  329. &.btn-xs {
  330. .navbar-vertical-align(22);
  331. }
  332. }
  333. // Text in navbars
  334. //
  335. // Add a class to make any element properly align itself vertically within the navbars.
  336. .navbar-text {
  337. .navbar-vertical-align(@line-height-computed);
  338. @media (min-width: @grid-float-breakpoint) {
  339. float: left;
  340. margin-left: @navbar-padding-horizontal;
  341. margin-right: @navbar-padding-horizontal;
  342. // Outdent the form if last child to line up with content down the page
  343. &.navbar-right:last-child {
  344. margin-right: 0;
  345. }
  346. }
  347. }
  348. // Alternate navbars
  349. // --------------------------------------------------
  350. // Default navbar
  351. .navbar-default {
  352. background-color: @navbar-default-bg;
  353. border-color: @navbar-default-border;
  354. padding: @navbar-default-padding;
  355. position: absolute;
  356. top: 0;
  357. width: 100%;
  358. height: @header-height;
  359. .navbar-brand {
  360. position: absolute;
  361. top: 5px;
  362. bottom: 5px;
  363. width: @navbar-brand-width;
  364. padding: 0;
  365. background-image: @navbar-brand-image-url;
  366. background-size: contain;
  367. background-repeat: no-repeat;
  368. background-position: left center;
  369. }
  370. .navbar-text {
  371. color: @navbar-default-color;
  372. }
  373. .navbar-nav {
  374. > li > a {
  375. color: @navbar-default-link-color;
  376. border: 2px solid transparent;
  377. font-size: @navbar-btn-font-size;
  378. font-weight: @navbar-btn-font-weight;
  379. line-height: @navbar-btn-line-height;
  380. background-color: @navbar-default-link-bg;
  381. @media (min-width: @grid-float-breakpoint) {
  382. border-radius: @navbar-btn-border-radius;
  383. padding: @navbar-btn-padding;
  384. }
  385. &:hover,
  386. &:focus {
  387. color: #fff;
  388. background-color: @navbar-default-link-hover-bg;
  389. border: 2px solid @navbar-default-link-hover-color;
  390. }
  391. }
  392. > .active > a {
  393. &,
  394. &:hover,
  395. &:focus {
  396. color: @navbar-default-link-active-color;
  397. background-color: @navbar-default-link-active-bg;
  398. }
  399. }
  400. > .disabled > a {
  401. &,
  402. &:hover,
  403. &:focus {
  404. color: @navbar-default-link-disabled-color;
  405. background-color: @navbar-default-link-disabled-bg;
  406. }
  407. }
  408. > li.subdued > a {
  409. border: 0;
  410. color: @navbar-subdued-color;
  411. margin-left: 0;
  412. background-color: transparent;
  413. &:hover,
  414. &:focus {
  415. color: @navbar-subdued-hover-color;
  416. background-color: @navbar-subdued-hover-bg;
  417. }
  418. &:focus {
  419. .tab-focus();
  420. }
  421. @media (min-width: @grid-float-breakpoint) {
  422. padding: @navbar-subdued-padding;
  423. }
  424. }
  425. > li.primary > a {
  426. .btn-borderless();
  427. }
  428. > li.secondary > a {
  429. .btn-bordered();
  430. border-width: @border-radius-small;
  431. }
  432. @media (min-width: @grid-float-breakpoint) {
  433. > li > a {
  434. border-color: @navbar-default-link-border-color;
  435. margin-left: 1rem;
  436. }
  437. }
  438. }
  439. .navbar-toggle {
  440. &.collapsed {
  441. border-color: @navbar-default-toggle-border-color;
  442. color: @navbar-default-link-color;
  443. transition: 0.2s ease-out;
  444. }
  445. &:not(.collapsed) {
  446. background-color: @navbar-default-toggle-hover-bg;
  447. border-color: @navbar-default-toggle-hover-bg;
  448. color: #fff;
  449. transition: 0.2s ease-in;
  450. }
  451. }
  452. .navbar-collapse,
  453. .navbar-form {
  454. border-color: @navbar-default-border;
  455. }
  456. .navbar-collapse.in {
  457. box-shadow: 0 10px 15px rgba(0, 0, 0, 0.25);
  458. }
  459. // Dropdown menu items
  460. .navbar-nav {
  461. // Remove background color from open dropdown
  462. > .open > a {
  463. &,
  464. &:hover,
  465. &:focus {
  466. background-color: @navbar-default-link-active-bg;
  467. color: @navbar-default-link-active-color;
  468. }
  469. }
  470. > .open.subdued > a {
  471. &,
  472. &:hover,
  473. &:focus {
  474. color: @navbar-subdued-hover-color;
  475. background-color: @navbar-subdued-hover-bg;
  476. }
  477. }
  478. @media (max-width: @grid-float-breakpoint-max) {
  479. // Dropdowns get custom display when collapsed
  480. .open .dropdown-menu {
  481. background-color: lighten(@navbar-default-bg, 10%);
  482. > li > div.subdued {
  483. color: mix(@navbar-default-link-color, @navbar-default-bg);
  484. }
  485. > li > a,
  486. > li > form > button {
  487. // padding: 12px 12px 13px 30px;
  488. color: @navbar-default-link-color;
  489. &:hover,
  490. &:focus {
  491. color: #fff;
  492. background-color: @navbar-default-link-hover-bg;
  493. }
  494. }
  495. > .active > a,
  496. > .active > form > button {
  497. &,
  498. &:hover,
  499. &:focus {
  500. color: @navbar-default-link-active-color;
  501. background-color: @navbar-default-link-active-bg;
  502. }
  503. }
  504. > .disabled > a,
  505. > .disabled > form > button {
  506. &,
  507. &:hover,
  508. &:focus {
  509. color: @navbar-default-link-disabled-color;
  510. background-color: @navbar-default-link-disabled-bg;
  511. }
  512. }
  513. }
  514. }
  515. }
  516. // Links in navbars
  517. //
  518. // Add a class to ensure links outside the navbar nav are colored correctly.
  519. .navbar-link {
  520. color: @navbar-default-link-color;
  521. &:hover {
  522. color: @navbar-default-link-hover-color;
  523. }
  524. }
  525. @media (min-width: @grid-float-breakpoint) {
  526. padding: @navbar-default-padding-v 0;
  527. }
  528. }
  529. // Accessibility
  530. .skip-to-content {
  531. color: @navbar-default-link-color;
  532. background-color: @navbar-default-link-bg;
  533. border: 2px solid transparent;
  534. border-radius: @navbar-btn-border-radius;
  535. font-size: @navbar-btn-font-size;
  536. font-weight: @navbar-btn-font-weight;
  537. left: @navbar-brand-width + @padding-lg;
  538. line-height: @navbar-btn-line-height;
  539. padding: @navbar-btn-padding;
  540. position: absolute;
  541. top: -200px;
  542. z-index: @zindex-navbar + 1;
  543. &:focus {
  544. background-color: @navbar-default-link-hover-bg;
  545. border: 2px solid @navbar-default-link-hover-color;
  546. color: @white;
  547. text-decoration: none;
  548. top: @navbar-default-padding-v;
  549. }
  550. }
  551. .website-redesign-navbar {
  552. &.navbar-default {
  553. background-color: @navbar-default-bg-website-redesign;
  554. .navbar-brand {
  555. background-image: @navbar-brand-image-url-website-redesign;
  556. }
  557. .navbar-text {
  558. color: @navbar-default-color-website-redesign;
  559. }
  560. // There is this -15px margin hack that is needed on the original
  561. // This causes inconsistency with the website redesign navbar,
  562. // so reset it to 0 for now
  563. @media (min-width: @grid-float-breakpoint) {
  564. .navbar-right:last-child {
  565. margin-right: 0;
  566. }
  567. }
  568. .navbar-nav {
  569. > li > a {
  570. color: @navbar-default-link-color-website-redesign;
  571. // border: 2px solid transparent;
  572. @media (min-width: @grid-float-breakpoint) {
  573. border-radius: @navbar-btn-border-radius;
  574. padding: @navbar-btn-padding;
  575. }
  576. }
  577. > li.subdued > a {
  578. color: @navbar-subdued-color-website-redesign;
  579. &:hover,
  580. &:focus {
  581. color: @navbar-subdued-hover-color-website-redesign;
  582. background-color: @navbar-subdued-hover-bg-website-redesign;
  583. }
  584. &:focus {
  585. .tab-focus();
  586. }
  587. @media (min-width: @grid-float-breakpoint) {
  588. padding: @navbar-subdued-padding;
  589. }
  590. }
  591. > li.primary > a {
  592. .btn-borderless(@white, @green-50, @green-60);
  593. }
  594. > li.secondary > a {
  595. .btn-bordered();
  596. border-width: @border-radius-small;
  597. border-color: transparent;
  598. @media (min-width: @grid-float-breakpoint) {
  599. border-color: @btn-bordered-border-color;
  600. }
  601. }
  602. }
  603. .navbar-toggle {
  604. &.collapsed {
  605. border-color: @navbar-default-toggle-border-color-website-redesign;
  606. color: @navbar-default-link-color-website-redesign;
  607. transition: 0.2s ease-out;
  608. }
  609. &:not(.collapsed) {
  610. background-color: @navbar-default-toggle-hover-bg-website-redesign;
  611. border-color: @navbar-default-toggle-hover-bg-website-redesign;
  612. color: #fff;
  613. transition: 0.2s ease-in;
  614. }
  615. }
  616. .navbar-collapse {
  617. // Use absolute positioning to build the hamburger menu.
  618. background-color: @navbar-default-bg-website-redesign;
  619. border-bottom: solid 1px @navbar-default-border;
  620. }
  621. // Dropdown menu items
  622. .navbar-nav {
  623. .dropdown-menu-button,
  624. .dropdown-menu > li > a {
  625. &:hover,
  626. &:focus {
  627. background-color: @navbar-default-link-active-bg-website-redesign;
  628. }
  629. }
  630. // Remove background color from open dropdown
  631. > .open > a {
  632. &,
  633. &:hover,
  634. &:focus {
  635. background-color: @btn-secondary-hover-bg-color; // force secondary button style
  636. color: @navbar-default-link-active-color-website-redesign;
  637. }
  638. }
  639. > .open.subdued > a {
  640. &,
  641. &:hover,
  642. &:focus {
  643. color: @navbar-subdued-hover-color-website-redesign;
  644. background-color: @navbar-subdued-hover-bg-website-redesign;
  645. }
  646. }
  647. @media (max-width: @grid-float-breakpoint-max) {
  648. // Dropdowns get custom display when collapsed
  649. .open .dropdown-menu {
  650. background-color: darken(@navbar-default-bg-website-redesign, 5%);
  651. > li > div.subdued {
  652. color: mix(
  653. @navbar-default-link-color-website-redesign,
  654. @navbar-default-bg-website-redesign
  655. );
  656. }
  657. > li > a,
  658. > li > form > button {
  659. // padding: 12px 12px 13px 30px;
  660. color: @navbar-default-link-color-website-redesign;
  661. &:hover,
  662. &:focus {
  663. color: #fff;
  664. background-color: @navbar-default-link-hover-bg-website-redesign;
  665. }
  666. }
  667. > .active > a,
  668. > .active > form > button {
  669. &,
  670. &:hover,
  671. &:focus {
  672. color: @navbar-default-link-active-color-website-redesign;
  673. background-color: @navbar-default-link-active-bg-website-redesign;
  674. }
  675. }
  676. > .disabled > a,
  677. > .disabled > form > button {
  678. &,
  679. &:hover,
  680. &:focus {
  681. color: @navbar-default-link-disabled-color-website-redesign;
  682. background-color: @navbar-default-link-disabled-bg;
  683. }
  684. }
  685. }
  686. }
  687. }
  688. }
  689. }