0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00

Do some CSS and Migration guide cleanup (#36191)

* Do some CSS and Migration guide cleanup

- More code snippet tweaks
- Fix some homepage hero bugs
- Do a cleanup on Migration guide content to highlight more changes and fix some issues from merge conflicts
This commit is contained in:
Mark Otto 2022-04-18 20:56:18 -07:00 committed by GitHub
parent 3990ff04a0
commit 3362c8cf13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 44 deletions

View File

@ -82,6 +82,15 @@
// Docs examples // Docs examples
// //
.bd-example-snippet {
border: solid $border-color;
border-width: 1px 0;
@include media-breakpoint-up(md) {
border-width: 1px;
}
}
.bd-example { .bd-example {
position: relative; position: relative;
padding: 1rem; padding: 1rem;
@ -371,8 +380,6 @@
.bd-code-snippet { .bd-code-snippet {
margin: $spacer ($bd-gutter-x * -.5); margin: $spacer ($bd-gutter-x * -.5);
border: solid $border-color;
border-width: 1px 0;
.highlight { .highlight {
margin-bottom: 0; margin-bottom: 0;
@ -381,7 +388,6 @@
@include media-breakpoint-up(md) { @include media-breakpoint-up(md) {
margin-right: 0; margin-right: 0;
margin-left: 0; margin-left: 0;
border-width: 1px;
@include border-radius($border-radius); @include border-radius($border-radius);
} }
} }

View File

@ -20,9 +20,13 @@
color: $gray-700; color: $gray-700;
} }
.bd-code-snippet {
margin: 0;
@include border-radius(.5rem);
}
.highlight { .highlight {
padding: .5rem 4rem .5rem 1rem; padding: .5rem 4rem .5rem 1rem;
margin-bottom: 0;
line-height: 1.25; line-height: 1.25;
background-color: rgba(var(--bs-body-color-rgb), .075); background-color: rgba(var(--bs-body-color-rgb), .075);
@include border-radius(.5rem); @include border-radius(.5rem);

View File

@ -35,7 +35,7 @@
font-weight: 600; font-weight: 600;
color: #fff; color: #fff;
} }
.gi { color: var(--base0C); } .gi { color: var(--bs-success); }
.gp { .gp {
font-weight: 600; font-weight: 600;
color: var(--base04); color: var(--base04);

View File

@ -143,24 +143,10 @@ When backdrop is set to static, the offcanvas will not close when clicking outsi
Responsive offcanvas classes hide content outside the viewport from a specified breakpoint and down. Above that breakpoint, the contents within will behave as usual. For example, `.offcanvas-lg` hides content in an offcanvas below the `lg` breakpoint, but shows the content above the `lg` breakpoint. Responsive offcanvas classes hide content outside the viewport from a specified breakpoint and down. Above that breakpoint, the contents within will behave as usual. For example, `.offcanvas-lg` hides content in an offcanvas below the `lg` breakpoint, but shows the content above the `lg` breakpoint.
<div class="bd-example"> {{< example >}}
<button class="btn btn-primary d-lg-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasResponsive" aria-controls="offcanvasResponsive">Toggle offcanvas</button> <button class="btn btn-primary d-lg-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasResponsive" aria-controls="offcanvasResponsive">Toggle offcanvas</button>
<div class="alert alert-info d-none d-lg-block">Resize your browser to show the responsive offcanvas toggle.</div> <div class="alert alert-info d-none d-lg-block">Resize your browser to show the responsive offcanvas toggle.</div>
<div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasResponsive" aria-labelledby="offcanvasResponsiveLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasResponsiveLabel">Responsive offcanvas</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<p class="mb-0">This is content within an <code>.offcanvas-lg</code>.</p>
</div>
</div>
</div>
```html
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasResponsive" aria-controls="offcanvasResponsive">Toggle offcanvas</button>
<div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasResponsive" aria-labelledby="offcanvasResponsiveLabel"> <div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasResponsive" aria-labelledby="offcanvasResponsiveLabel">
<div class="offcanvas-header"> <div class="offcanvas-header">
@ -171,7 +157,7 @@ Responsive offcanvas classes hide content outside the viewport from a specified
<p class="mb-0">This is content within an <code>.offcanvas-lg</code>.</p> <p class="mb-0">This is content within an <code>.offcanvas-lg</code>.</p>
</div> </div>
</div> </div>
``` {{< /example >}}
Responsive offcanvas classes are available across for each breakpoint. Responsive offcanvas classes are available across for each breakpoint.

View File

@ -17,23 +17,7 @@ Bootstrap v5.2.0 features a subtle design update for a handful of components and
### More CSS variables ### More CSS variables
**We've updated nearly all our components to use CSS variables.** While Sass still underpins everything, each component has been updated to include CSS variables on the component base classes (e.g., `.btn`), allowing for more real-time customization of Bootstrap. **We've updated all our components to use CSS variables.** While Sass still underpins everything, each component has been updated to include CSS variables on the component base classes (e.g., `.btn`), allowing for more real-time customization of Bootstrap. In subsequent releases, we'll continue to expand our use of CSS variables into our layout, forms, helpers, and utilities. Read more about CSS variables in each component on their respective documentation pages.
The following components are now built with CSS variables:
- [Alerts]({{< docsref "/components/alerts/" >}})
- [Badges]({{< docsref "/components/badge/" >}})
- [Breadcrumbs]({{< docsref "/components/breadcrumb/" >}})
- [Buttons]({{< docsref "/components/buttons/" >}})
- [Dropdowns]({{< docsref "/components/dropdowns/" >}})
- [Navbars]({{< docsref "/components/navbar/" >}})
- [Pagination]({{< docsref "/components/pagination/" >}})
- [Popovers]({{< docsref "/components/popovers/" >}})
- [Progress]({{< docsref "/components/progress/" >}})
- [Spinners]({{< docsref "/components/spinners/" >}})
- [Tooltips]({{< docsref "/components/tooltips/" >}})
Read more about CSS variables in each component on their respective documentation pages. The rest of our components, forms, and more will be updated by v5.3.
Our CSS variable usage will be somewhat incomplete until Bootstrap 6. While we'd love to fully implement these across the board, they do run the risk of causing breaking changes. For example, setting `$alert-border-width: var(--bs-border-width)` in our source code breaks potential Sass in your own code if you were doing `$alert-border-width * 2` for some reason. Our CSS variable usage will be somewhat incomplete until Bootstrap 6. While we'd love to fully implement these across the board, they do run the risk of causing breaking changes. For example, setting `$alert-border-width: var(--bs-border-width)` in our source code breaks potential Sass in your own code if you were doing `$alert-border-width * 2` for some reason.
@ -43,7 +27,7 @@ As such, wherever possible, we will continue to push towards more CSS variables,
**Bootstrap v5.2.0 introduced a new Sass file with `_maps.scss`.** It pulls out several Sass maps from `_variables.scss` to fix an issue where updates to an original map were not applied to secondary maps that extend them. For example, updates to `$theme-colors` were not being applied to other theme maps that relied on `$theme-colors`, breaking key customization workflows. In short, Sass has a limitation where once a default variable or map has been _used_, it cannot be updated. _There's a similar shortcoming with CSS variables when they're used to compose other CSS variables._ **Bootstrap v5.2.0 introduced a new Sass file with `_maps.scss`.** It pulls out several Sass maps from `_variables.scss` to fix an issue where updates to an original map were not applied to secondary maps that extend them. For example, updates to `$theme-colors` were not being applied to other theme maps that relied on `$theme-colors`, breaking key customization workflows. In short, Sass has a limitation where once a default variable or map has been _used_, it cannot be updated. _There's a similar shortcoming with CSS variables when they're used to compose other CSS variables._
This is why variable customizations in Bootstrap have to come after `@import "functions"`, but before `@import "variables"` and the rest of our import stack. The same applies to Sass maps—you must override the defaults before the defaults get used. The following maps have been moved to the new `_maps.scss`: This is why variable customizations in Bootstrap have to come after `@import "functions"`, but before `@import "variables"` and the rest of our import stack. The same applies to Sass maps—you must override the defaults before they get used. The following maps have been moved to the new `_maps.scss`:
- `$theme-colors-rgb` - `$theme-colors-rgb`
- `$utilities-colors` - `$utilities-colors`
@ -92,11 +76,19 @@ Your custom Bootstrap CSS builds should now look something like this with a sepa
- **Introduced new `$enable-container-classes` option. —** Now when opting into the experimental CSS Grid layout, `.container-*` classes will still be compiled, unless this option is set to `false`. Containers also now keep their gutter values. - **Introduced new `$enable-container-classes` option. —** Now when opting into the experimental CSS Grid layout, `.container-*` classes will still be compiled, unless this option is set to `false`. Containers also now keep their gutter values.
- **Offcanvas component now has [responsive variations]({{< docsref "/components/offcanvas#responsive" >}}).** The original `.offcanvas` class remains unchanged—it hides content across all viewports. To make it responsive, change that `.offcanvas` class to any `.offcanvas-{sm|md|lg|xl|xxl}` class.
- **Thicker table dividers are now opt-in. —** We've removed the thicker and more difficult to override border between table groups and moved it to an optional class you can apply, `.table-group-divider`. [See the table docs for an example.]({{< docsref "/content/tables#table-group-dividers" >}}) - **Thicker table dividers are now opt-in. —** We've removed the thicker and more difficult to override border between table groups and moved it to an optional class you can apply, `.table-group-divider`. [See the table docs for an example.]({{< docsref "/content/tables#table-group-dividers" >}})
- **[Scrollspy has been rewritten](https://github.com/twbs/bootstrap/pull/33421) to use the Intersection Observer API**, which means you no longer need relative parent wrappers, deprecates `offset` config, and more. Look for your Scrollspy implementations to be more accurate and consistent in their nav highlighting.
- **Popovers and tooltips now use CSS variables.** Some CSS variables have been updated from their Sass counterparts to reduce the number of variables. As a result, three variables have been deprecated in this release: `$popover-arrow-color`, `$popover-arrow-outer-color`, and `$tooltip-arrow-color`.
- Added `.form-check-reverse` modifier to flip the order of labels and associated checkboxes/radios. - Added `.form-check-reverse` modifier to flip the order of labels and associated checkboxes/radios.
- Added striped columns support to tables via - Added [striped columns]({{< docsref "/content/tables#striped-columns" >}}) support to tables via the new `.table-striped-columns` class.
For a complete list of changes, [see the v5.2.0 project on GitHub](https://github.com/twbs/bootstrap/projects/32).
## v5.1.0 ## v5.1.0
@ -128,8 +120,6 @@ Want more information? [Read the v5.1.0 blog post.](https://blog.getbootstrap.co
**Hey there!** Changes to our first major release of Bootstrap 5, v5.0.0, are documented below. They don't reflect the additional changes shown above. **Hey there!** Changes to our first major release of Bootstrap 5, v5.0.0, are documented below. They don't reflect the additional changes shown above.
{{< /callout >}} {{< /callout >}}
- **Popovers and tooltips now use CSS variables.** Both components have been updated to use CSS variables on their base classes, `.popover` and `.tooltip`. Some CSS variables have been updated from their Sass counterparts to reduce the number of variables. As a result, three variables have been deprecated in this release: `$popover-arrow-color`, `$popover-arrow-outer-color`, and `$tooltip-arrow-color`.
## Dependencies ## Dependencies
- Dropped jQuery. - Dropped jQuery.