0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-12 00:08:59 +01:00
Bootstrap/scss/_nav.scss

198 lines
5.1 KiB
SCSS
Raw Normal View History

// Base class
2012-06-29 06:46:45 +02:00
//
// Kickstart any navigation component with a set of style resets. Works with
2019-03-07 13:38:33 +01:00
// `<nav>`s, `<ul>`s or `<ol>`s.
2014-07-09 22:51:49 +02:00
.nav {
// scss-docs-start nav-css-vars
--#{$prefix}nav-link-padding-x: #{$nav-link-padding-x};
--#{$prefix}nav-link-padding-y: #{$nav-link-padding-y};
@include rfs($nav-link-font-size, --#{$prefix}nav-link-font-size);
--#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
--#{$prefix}nav-link-color: #{$nav-link-color};
--#{$prefix}nav-link-hover-color: #{$nav-link-hover-color};
--#{$prefix}nav-link-disabled-color: #{$nav-link-disabled-color};
// scss-docs-end nav-css-vars
display: flex;
flex-wrap: wrap;
padding-left: 0;
2014-07-14 08:33:54 +02:00
margin-bottom: 0;
list-style: none;
2014-07-09 22:51:49 +02:00
}
.nav-link {
display: block;
padding: var(--#{$prefix}nav-link-padding-y) var(--#{$prefix}nav-link-padding-x);
@include font-size(var(--#{$prefix}nav-link-font-size));
font-weight: var(--#{$prefix}nav-link-font-weight);
color: var(--#{$prefix}nav-link-color);
text-decoration: if($link-decoration == none, null, none);
background: none;
border: 0;
2020-04-06 13:29:39 +02:00
@include transition($nav-link-transition);
2014-07-09 22:51:49 +02:00
&:hover,
&:focus {
color: var(--#{$prefix}nav-link-hover-color);
text-decoration: if($link-hover-decoration == underline, none, null);
2014-07-09 22:51:49 +02:00
}
&:focus-visible {
outline: 0;
box-shadow: $nav-link-focus-box-shadow;
}
2017-04-10 23:07:44 +02:00
// Disabled state lightens text
&.disabled,
&:disabled {
color: var(--#{$prefix}nav-link-disabled-color);
pointer-events: none;
cursor: default;
2014-07-09 22:51:49 +02:00
}
}
//
2012-11-04 00:14:44 +01:00
// Tabs
//
.nav-tabs {
// scss-docs-start nav-tabs-css-vars
--#{$prefix}nav-tabs-border-width: #{$nav-tabs-border-width};
--#{$prefix}nav-tabs-border-color: #{$nav-tabs-border-color};
--#{$prefix}nav-tabs-border-radius: #{$nav-tabs-border-radius};
--#{$prefix}nav-tabs-link-hover-border-color: #{$nav-tabs-link-hover-border-color};
--#{$prefix}nav-tabs-link-active-color: #{$nav-tabs-link-active-color};
--#{$prefix}nav-tabs-link-active-bg: #{$nav-tabs-link-active-bg};
--#{$prefix}nav-tabs-link-active-border-color: #{$nav-tabs-link-active-border-color};
// scss-docs-end nav-tabs-css-vars
border-bottom: var(--#{$prefix}nav-tabs-border-width) solid var(--#{$prefix}nav-tabs-border-color);
.nav-link {
margin-bottom: calc(-1 * var(--#{$prefix}nav-tabs-border-width)); // stylelint-disable-line function-disallowed-list
border: var(--#{$prefix}nav-tabs-border-width) solid transparent;
@include border-top-radius(var(--#{$prefix}nav-tabs-border-radius));
2013-04-16 16:45:51 +02:00
&:hover,
&:focus {
// Prevents active .nav-link tab overlapping focus outline of previous/next .nav-link
isolation: isolate;
border-color: var(--#{$prefix}nav-tabs-link-hover-border-color);
2013-04-16 16:45:51 +02:00
}
}
2013-04-16 16:45:51 +02:00
.nav-link.active,
.nav-item.show .nav-link {
color: var(--#{$prefix}nav-tabs-link-active-color);
background-color: var(--#{$prefix}nav-tabs-link-active-bg);
border-color: var(--#{$prefix}nav-tabs-link-active-border-color);
2013-04-16 16:45:51 +02:00
}
.dropdown-menu {
// Make dropdown border overlap tab border
margin-top: calc(-1 * var(--#{$prefix}nav-tabs-border-width)); // stylelint-disable-line function-disallowed-list
// Remove the top rounded corners here since there is a hard edge above the menu
@include border-top-radius(0);
}
}
//
// Pills
//
.nav-pills {
// scss-docs-start nav-pills-css-vars
--#{$prefix}nav-pills-border-radius: #{$nav-pills-border-radius};
--#{$prefix}nav-pills-link-active-color: #{$nav-pills-link-active-color};
--#{$prefix}nav-pills-link-active-bg: #{$nav-pills-link-active-bg};
// scss-docs-end nav-pills-css-vars
.nav-link {
@include border-radius(var(--#{$prefix}nav-pills-border-radius));
}
.nav-link.active,
.show > .nav-link {
color: var(--#{$prefix}nav-pills-link-active-color);
@include gradient-bg(var(--#{$prefix}nav-pills-link-active-bg));
}
}
//
// Underline
//
.nav-underline {
// scss-docs-start nav-underline-css-vars
--#{$prefix}nav-underline-gap: #{$nav-underline-gap};
--#{$prefix}nav-underline-border-width: #{$nav-underline-border-width};
--#{$prefix}nav-underline-link-active-color: #{$nav-underline-link-active-color};
// scss-docs-end nav-underline-css-vars
gap: var(--#{$prefix}nav-underline-gap);
.nav-link {
padding-right: 0;
padding-left: 0;
border-bottom: var(--#{$prefix}nav-underline-border-width) solid transparent;
&:hover,
&:focus {
border-bottom-color: currentcolor;
}
}
.nav-link.active,
.show > .nav-link {
font-weight: $font-weight-bold;
color: var(--#{$prefix}nav-underline-link-active-color);
border-bottom-color: currentcolor;
}
}
//
// Justified variants
//
.nav-fill {
> .nav-link,
.nav-item {
flex: 1 1 auto;
text-align: center;
}
}
.nav-justified {
> .nav-link,
.nav-item {
2017-03-20 01:47:53 +01:00
flex-grow: 1;
Build(deps-dev): Bump the development-dependencies group across 1 directory with 9 updates (#40895) * Build(deps-dev): Bump the development-dependencies group across 1 directory with 9 updates Bumps the development-dependencies group with 9 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@docsearch/js](https://github.com/algolia/docsearch) | `3.6.1` | `3.6.2` | | [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/HEAD/packages/commonjs) | `26.0.1` | `28.0.0` | | [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/HEAD/packages/node-resolve) | `15.2.3` | `15.3.0` | | [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/HEAD/packages/replace) | `5.0.7` | `6.0.1` | | [eslint-plugin-html](https://github.com/BenoitZugmeyer/eslint-plugin-html) | `8.1.1` | `8.1.2` | | [nodemon](https://github.com/remy/nodemon) | `3.1.4` | `3.1.7` | | [postcss](https://github.com/postcss/postcss) | `8.4.45` | `8.4.47` | | [sass](https://github.com/sass/dart-sass) | `1.77.8` | `1.78.0` | | [stylelint-config-twbs-bootstrap](https://github.com/twbs/stylelint-config-twbs-bootstrap) | `15.0.0` | `15.1.0` | Updates `@docsearch/js` from 3.6.1 to 3.6.2 - [Release notes](https://github.com/algolia/docsearch/releases) - [Changelog](https://github.com/algolia/docsearch/blob/main/CHANGELOG.md) - [Commits](https://github.com/algolia/docsearch/compare/v3.6.1...v3.6.2) Updates `@rollup/plugin-commonjs` from 26.0.1 to 28.0.0 - [Changelog](https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md) - [Commits](https://github.com/rollup/plugins/commits/commonjs-v28.0.0/packages/commonjs) Updates `@rollup/plugin-node-resolve` from 15.2.3 to 15.3.0 - [Changelog](https://github.com/rollup/plugins/blob/master/packages/node-resolve/CHANGELOG.md) - [Commits](https://github.com/rollup/plugins/commits/node-resolve-v15.3.0/packages/node-resolve) Updates `@rollup/plugin-replace` from 5.0.7 to 6.0.1 - [Changelog](https://github.com/rollup/plugins/blob/master/packages/replace/CHANGELOG.md) - [Commits](https://github.com/rollup/plugins/commits/json-v6.0.1/packages/replace) Updates `eslint-plugin-html` from 8.1.1 to 8.1.2 - [Changelog](https://github.com/BenoitZugmeyer/eslint-plugin-html/blob/main/CHANGELOG.md) - [Commits](https://github.com/BenoitZugmeyer/eslint-plugin-html/compare/v8.1.1...v8.1.2) Updates `nodemon` from 3.1.4 to 3.1.7 - [Release notes](https://github.com/remy/nodemon/releases) - [Commits](https://github.com/remy/nodemon/compare/v3.1.4...v3.1.7) Updates `postcss` from 8.4.45 to 8.4.47 - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.4.45...8.4.47) Updates `sass` from 1.77.8 to 1.78.0 - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.77.8...1.78.0) Updates `stylelint-config-twbs-bootstrap` from 15.0.0 to 15.1.0 - [Release notes](https://github.com/twbs/stylelint-config-twbs-bootstrap/releases) - [Commits](https://github.com/twbs/stylelint-config-twbs-bootstrap/compare/v15.0.0...v15.1.0) --- updated-dependencies: - dependency-name: "@docsearch/js" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development-dependencies - dependency-name: "@rollup/plugin-commonjs" dependency-type: direct:development update-type: version-update:semver-major dependency-group: development-dependencies - dependency-name: "@rollup/plugin-node-resolve" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: "@rollup/plugin-replace" dependency-type: direct:development update-type: version-update:semver-major dependency-group: development-dependencies - dependency-name: eslint-plugin-html dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development-dependencies - dependency-name: nodemon dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development-dependencies - dependency-name: postcss dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development-dependencies - dependency-name: sass dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: stylelint-config-twbs-bootstrap dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * Fix new stylelint-config-recess-order issues (#40887) * Pin sass to 1.78 If the issues are fixed, it should be updated again along with the caret operator. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2024-10-02 07:11:23 +02:00
flex-basis: 0;
text-align: center;
}
}
.nav-fill,
.nav-justified {
.nav-item .nav-link {
width: 100%; // Make sure button will grow
}
}
// Tabbable tabs
//
// Hide tabbable panes to start, show them when `.active`
.tab-content {
> .tab-pane {
display: none;
}
2013-07-07 06:51:47 +02:00
> .active {
display: block;
}
}