diff options
author | Mark Otto <markd.otto@gmail.com> | 2022-04-19 21:21:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 21:21:43 +0300 |
commit | e089aef00fef68c6a815327d8b988e14cfcf4d9b (patch) | |
tree | 12b55f0088354b7be006fe9f3934e291fab08d07 /site/content | |
parent | 9ec51f449904bae076b2334e748559706182f046 (diff) |
Refactor some docs examples CSS (#36194)
* Fix some more borders and margins
* Flex utilities docs: remove .bd-highlight class from snippets
* Explicit close target
* Reorder to keep base class up top
* Fix custom position example
* Tooltips: add code snippet, use scss-docs ref for custom tooltip
* Tweak text for pagination examples
* Modals: move custom styles to utilities
* Grid docs: Combine selectors and share coloring
* Refactor tons of little things
Diffstat (limited to 'site/content')
-rw-r--r-- | site/content/docs/5.1/components/modal.md | 4 | ||||
-rw-r--r-- | site/content/docs/5.1/components/offcanvas.md | 2 | ||||
-rw-r--r-- | site/content/docs/5.1/components/pagination.md | 4 | ||||
-rw-r--r-- | site/content/docs/5.1/components/tooltips.md | 15 | ||||
-rw-r--r-- | site/content/docs/5.1/layout/css-grid.md | 30 | ||||
-rw-r--r-- | site/content/docs/5.1/utilities/flex.md | 546 | ||||
-rw-r--r-- | site/content/docs/5.1/utilities/position.md | 2 |
7 files changed, 301 insertions, 302 deletions
diff --git a/site/content/docs/5.1/components/modal.md b/site/content/docs/5.1/components/modal.md index a33f7e615d..d9bd120d46 100644 --- a/site/content/docs/5.1/components/modal.md +++ b/site/content/docs/5.1/components/modal.md @@ -38,8 +38,8 @@ Keep reading for demos and usage guidelines. Below is a _static_ modal example (meaning its `position` and `display` have been overridden). Included are the modal header, modal body (required for `padding`), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action. -<div class="bd-example bd-example-modal"> - <div class="modal" tabindex="-1"> +<div class="bd-example bg-light"> + <div class="modal position-static d-block" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> diff --git a/site/content/docs/5.1/components/offcanvas.md b/site/content/docs/5.1/components/offcanvas.md index 3abdc3acf0..56ae26e6ba 100644 --- a/site/content/docs/5.1/components/offcanvas.md +++ b/site/content/docs/5.1/components/offcanvas.md @@ -151,7 +151,7 @@ Responsive offcanvas classes hide content outside the viewport from a specified <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> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#offcanvasResponsive" aria-label="Close"></button> </div> <div class="offcanvas-body"> <p class="mb-0">This is content within an <code>.offcanvas-lg</code>.</p> diff --git a/site/content/docs/5.1/components/pagination.md b/site/content/docs/5.1/components/pagination.md index 8e05a18614..7251405761 100644 --- a/site/content/docs/5.1/components/pagination.md +++ b/site/content/docs/5.1/components/pagination.md @@ -122,7 +122,7 @@ Fancy larger or smaller pagination? Add `.pagination-lg` or `.pagination-sm` for ## Alignment -Change the alignment of pagination components with [flexbox utilities]({{< docsref "/utilities/flex" >}}). +Change the alignment of pagination components with [flexbox utilities]({{< docsref "/utilities/flex" >}}). For example, with `.justify-content-center`: {{< example >}} <nav aria-label="Page navigation example"> @@ -140,6 +140,8 @@ Change the alignment of pagination components with [flexbox utilities]({{< docsr </nav> {{< /example >}} +Or with `.justify-content-end`: + {{< example >}} <nav aria-label="Page navigation example"> <ul class="pagination justify-content-end"> diff --git a/site/content/docs/5.1/components/tooltips.md b/site/content/docs/5.1/components/tooltips.md index 1831dff722..9460da2a0b 100644 --- a/site/content/docs/5.1/components/tooltips.md +++ b/site/content/docs/5.1/components/tooltips.md @@ -47,10 +47,10 @@ var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { Hover over the links below to see tooltips: -<div class="bd-example tooltip-demo"> - <p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how <a href="#" data-bs-toggle="tooltip" title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" title="The last tip!">your own</a> site or project. - </p> -</div> +{{< example class="tooltip-demo" >}} +<p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how <a href="#" data-bs-toggle="tooltip" title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" title="The last tip!">your own</a> site or project. +</p> +{{< /example >}} ### Custom tooltips @@ -58,11 +58,8 @@ Hover over the links below to see tooltips: You can customize the appearance of tooltips using [CSS variables](#variables). We set a custom class with `data-bs-custom-class="custom-tooltip"` to scope our custom appearance and use it to override a local CSS variable. -```scss -.custom-tooltip { - --bs-tooltip-bg: var(--bs-primary); -} -``` +{{< scss-docs name="custom-tooltip" file="site/assets/scss/_component-examples.scss" >}} + {{< example class="tooltip-demo" >}} <button type="button" class="btn btn-secondary" diff --git a/site/content/docs/5.1/layout/css-grid.md b/site/content/docs/5.1/layout/css-grid.md index be049218da..4b0be38462 100644 --- a/site/content/docs/5.1/layout/css-grid.md +++ b/site/content/docs/5.1/layout/css-grid.md @@ -47,7 +47,7 @@ Compared to the default grid system: Three equal-width columns across all viewports and devices can be created by using the `.g-col-4` classes. Add [responsive classes](#responsive) to change the layout by viewport size. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div class="g-col-4">.g-col-4</div> <div class="g-col-4">.g-col-4</div> @@ -59,7 +59,7 @@ Three equal-width columns across all viewports and devices can be created by usi Use responsive classes to adjust your layout across viewports. Here we start with two columns on the narrowest viewports, and then grow to three columns on medium viewports and above. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div> <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div> @@ -69,7 +69,7 @@ Use responsive classes to adjust your layout across viewports. Here we start wit Compare that to this two column layout at all viewports. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div class="g-col-6">.g-col-6</div> <div class="g-col-6">.g-col-6</div> @@ -80,7 +80,7 @@ Compare that to this two column layout at all viewports. Grid items automatically wrap to the next line when there's no more room horizontally. Note that the `gap` applies to horizontal and vertical gaps between grid items. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div class="g-col-6">.g-col-6</div> <div class="g-col-6">.g-col-6</div> @@ -94,7 +94,7 @@ Grid items automatically wrap to the next line when there's no more room horizon Start classes aim to replace our default grid's offset classes, but they're not entirely the same. CSS Grid creates a grid template through styles that tell browsers to "start at this column" and "end at this column." Those properties are `grid-column-start` and `grid-column-end`. Start classes are shorthand for the former. Pair them with the column classes to size and align your columns however you need. Start classes begin at `1` as `0` is an invalid value for these properties. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div class="g-col-3 g-start-2">.g-col-3 .g-start-2</div> <div class="g-col-4 g-start-6">.g-col-4 .g-start-6</div> @@ -105,7 +105,7 @@ Start classes aim to replace our default grid's offset classes, but they're not When there are no classes on the grid items (the immediate children of a `.grid`), each grid item will automatically be sized to one column. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div>1</div> <div>1</div> @@ -124,7 +124,7 @@ When there are no classes on the grid items (the immediate children of a `.grid` This behavior can be mixed with grid column classes. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid"> <div class="g-col-6">.g-col-6</div> <div>1</div> @@ -147,7 +147,7 @@ Similar to our default grid system, our CSS Grid allows for easy nesting of `.gr In practice this allows for more complex and custom layouts when compared to our default grid system. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-columns: 3;"> <div> First auto-column @@ -186,7 +186,7 @@ These CSS variables have no default value; instead, they apply fallback values t Immediate children elements of `.grid` are grid items, so they'll be sized without explicitly adding a `.g-col` class. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-columns: 3;"> <div>Auto-column</div> <div>Auto-column</div> @@ -198,14 +198,14 @@ Immediate children elements of `.grid` are grid items, so they'll be sized witho Adjust the number of columns and the gap. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-columns: 4; --bs-gap: 5rem;"> <div class="g-col-2">.g-col-2</div> <div class="g-col-2">.g-col-2</div> </div> {{< /example >}} -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-columns: 10; --bs-gap: 1rem;"> <div class="g-col-6">.g-col-6</div> <div class="g-col-4">.g-col-4</div> @@ -216,7 +216,7 @@ Adjust the number of columns and the gap. Adding more rows and changing the placement of columns: -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-rows: 3; --bs-columns: 3;"> <div>Auto-column</div> <div class="g-start-2" style="grid-row: 2">Auto-column</div> @@ -228,7 +228,7 @@ Adding more rows and changing the placement of columns: Change the vertical gaps only by modifying the `row-gap`. Note that we use `gap` on `.grid`s, but `row-gap` and `column-gap` can be modified as needed. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="row-gap: 0;"> <div class="g-col-6">.g-col-6</div> <div class="g-col-6">.g-col-6</div> @@ -240,7 +240,7 @@ Change the vertical gaps only by modifying the `row-gap`. Note that we use `gap` Because of that, you can have different vertical and horizontal `gap`s, which can take a single value (all sides) or a pair of values (vertical and horizontal). This can be applied with an inline style for `gap`, or with our `--bs-gap` CSS variable. -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-gap: .25rem 1rem;"> <div class="g-col-6">.g-col-6</div> <div class="g-col-6">.g-col-6</div> @@ -259,7 +259,7 @@ One limitation of the CSS Grid is that our default classes are still generated b For example, you can increase the column count and change the gap size, and then size your "columns" with a mix of inline styles and predefined CSS Grid column classes (e.g., `.g-col-4`). -{{< example class="bd-example-cssgrid" >}} +{{< example class="bd-example-cssgrid text-center" >}} <div class="grid" style="--bs-columns: 18; --bs-gap: .5rem;"> <div style="grid-column: span 14;">14 columns</div> <div class="g-col-4">.g-col-4</div> diff --git a/site/content/docs/5.1/utilities/flex.md b/site/content/docs/5.1/utilities/flex.md index b9d359ab1d..567befe0ee 100644 --- a/site/content/docs/5.1/utilities/flex.md +++ b/site/content/docs/5.1/utilities/flex.md @@ -10,12 +10,12 @@ toc: true Apply `display` utilities to create a flexbox container and transform **direct children elements** into flex items. Flex containers and items are able to be modified further with additional flex properties. -{{< example >}} -<div class="d-flex p-2 bd-highlight">I'm a flexbox container!</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex p-2">I'm a flexbox container!</div> {{< /example >}} -{{< example >}} -<div class="d-inline-flex p-2 bd-highlight">I'm an inline flexbox container!</div> +{{< example class="bd-example-flex" >}} +<div class="d-inline-flex p-2">I'm an inline flexbox container!</div> {{< /example >}} Responsive variations also exist for `.d-flex` and `.d-inline-flex`. @@ -35,31 +35,31 @@ Set the direction of flex items in a flex container with direction utilities. In Use `.flex-row` to set a horizontal direction (the browser default), or `.flex-row-reverse` to start the horizontal direction from the opposite side. -{{< example >}} -<div class="d-flex flex-row bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item 1</div> - <div class="p-2 bd-highlight">Flex item 2</div> - <div class="p-2 bd-highlight">Flex item 3</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex flex-row mb-3"> + <div class="p-2">Flex item 1</div> + <div class="p-2">Flex item 2</div> + <div class="p-2">Flex item 3</div> </div> -<div class="d-flex flex-row-reverse bd-highlight"> - <div class="p-2 bd-highlight">Flex item 1</div> - <div class="p-2 bd-highlight">Flex item 2</div> - <div class="p-2 bd-highlight">Flex item 3</div> +<div class="d-flex flex-row-reverse"> + <div class="p-2">Flex item 1</div> + <div class="p-2">Flex item 2</div> + <div class="p-2">Flex item 3</div> </div> {{< /example >}} Use `.flex-column` to set a vertical direction, or `.flex-column-reverse` to start the vertical direction from the opposite side. -{{< example >}} -<div class="d-flex flex-column bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item 1</div> - <div class="p-2 bd-highlight">Flex item 2</div> - <div class="p-2 bd-highlight">Flex item 3</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex flex-column mb-3"> + <div class="p-2">Flex item 1</div> + <div class="p-2">Flex item 2</div> + <div class="p-2">Flex item 3</div> </div> -<div class="d-flex flex-column-reverse bd-highlight"> - <div class="p-2 bd-highlight">Flex item 1</div> - <div class="p-2 bd-highlight">Flex item 2</div> - <div class="p-2 bd-highlight">Flex item 3</div> +<div class="d-flex flex-column-reverse"> + <div class="p-2">Flex item 1</div> + <div class="p-2">Flex item 2</div> + <div class="p-2">Flex item 3</div> </div> {{< /example >}} @@ -80,36 +80,36 @@ Responsive variations also exist for `flex-direction`. Use `justify-content` utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if `flex-direction: column`). Choose from `start` (browser default), `end`, `center`, `between`, `around`, or `evenly`. -<div class="bd-example"> - <div class="d-flex justify-content-start bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex justify-content-start mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex justify-content-end bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex justify-content-end mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex justify-content-center bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex justify-content-center mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex justify-content-between bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex justify-content-between mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex justify-content-around bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex justify-content-around mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex justify-content-evenly bd-highlight"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex justify-content-evenly"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -141,31 +141,31 @@ Responsive variations also exist for `justify-content`. Use `align-items` utilities on flexbox containers to change the alignment of flex items on the cross axis (the y-axis to start, x-axis if `flex-direction: column`). Choose from `start`, `end`, `center`, `baseline`, or `stretch` (browser default). -<div class="bd-example"> - <div class="d-flex align-items-start bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-items-start mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex align-items-end bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex align-items-end mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex align-items-center bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex align-items-center mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex align-items-baseline bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex align-items-baseline mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex align-items-stretch bd-highlight" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex align-items-stretch" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -195,31 +195,31 @@ Responsive variations also exist for `align-items`. Use `align-self` utilities on flexbox items to individually change their alignment on the cross axis (the y-axis to start, x-axis if `flex-direction: column`). Choose from the same options as `align-items`: `start`, `end`, `center`, `baseline`, or `stretch` (browser default). -<div class="bd-example"> - <div class="d-flex bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="align-self-start p-2 bd-highlight">Aligned flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="align-self-start p-2">Aligned flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="align-self-end p-2 bd-highlight">Aligned flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="align-self-end p-2">Aligned flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="align-self-center p-2 bd-highlight">Aligned flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="align-self-center p-2">Aligned flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex bd-highlight mb-3" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="align-self-baseline p-2 bd-highlight">Aligned flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex mb-3" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="align-self-baseline p-2">Aligned flex item</div> + <div class="p-2">Flex item</div> </div> - <div class="d-flex bd-highlight" style="height: 100px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="align-self-stretch p-2 bd-highlight">Aligned flex item</div> - <div class="p-2 bd-highlight">Flex item</div> + <div class="d-flex" style="height: 100px"> + <div class="p-2">Flex item</div> + <div class="align-self-stretch p-2">Aligned flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -249,11 +249,11 @@ Responsive variations also exist for `align-self`. Use the `.flex-fill` class on a series of sibling elements to force them into widths equal to their content (or equal widths if their content does not surpass their border-boxes) while taking up all available horizontal space. -{{< example >}} -<div class="d-flex bd-highlight"> - <div class="p-2 flex-fill bd-highlight">Flex item with a lot of content</div> - <div class="p-2 flex-fill bd-highlight">Flex item</div> - <div class="p-2 flex-fill bd-highlight">Flex item</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex"> + <div class="p-2 flex-fill">Flex item with a lot of content</div> + <div class="p-2 flex-fill">Flex item</div> + <div class="p-2 flex-fill">Flex item</div> </div> {{< /example >}} @@ -271,20 +271,20 @@ Responsive variations also exist for `flex-fill`. Use `.flex-grow-*` utilities to toggle a flex item's ability to grow to fill available space. In the example below, the `.flex-grow-1` elements uses all available space it can, while allowing the remaining two flex items their necessary space. -{{< example >}} -<div class="d-flex bd-highlight"> - <div class="p-2 flex-grow-1 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Third flex item</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex"> + <div class="p-2 flex-grow-1">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Third flex item</div> </div> {{< /example >}} Use `.flex-shrink-*` utilities to toggle a flex item's ability to shrink if necessary. In the example below, the second flex item with `.flex-shrink-1` is forced to wrap its contents to a new line, "shrinking" to allow more space for the previous flex item with `.w-100`. -{{< example >}} -<div class="d-flex bd-highlight"> - <div class="p-2 w-100 bd-highlight">Flex item</div> - <div class="p-2 flex-shrink-1 bd-highlight">Flex item</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex"> + <div class="p-2 w-100">Flex item</div> + <div class="p-2 flex-shrink-1">Flex item</div> </div> {{< /example >}} @@ -303,23 +303,23 @@ Responsive variations also exist for `flex-grow` and `flex-shrink`. Flexbox can do some pretty awesome things when you mix flex alignments with auto margins. Shown below are three examples of controlling flex items via auto margins: default (no auto margin), pushing two items to the right (`.me-auto`), and pushing two items to the left (`.ms-auto`). -{{< example >}} -<div class="d-flex bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> -<div class="d-flex bd-highlight mb-3"> - <div class="me-auto p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="d-flex mb-3"> + <div class="me-auto p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> -<div class="d-flex bd-highlight mb-3"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="ms-auto p-2 bd-highlight">Flex item</div> +<div class="d-flex mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="ms-auto p-2">Flex item</div> </div> {{< /example >}} @@ -327,17 +327,17 @@ Flexbox can do some pretty awesome things when you mix flex alignments with auto Vertically move one flex item to the top or bottom of a container by mixing `align-items`, `flex-direction: column`, and `margin-top: auto` or `margin-bottom: auto`. -{{< example >}} -<div class="d-flex align-items-start flex-column bd-highlight mb-3" style="height: 200px;"> - <div class="mb-auto p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex align-items-start flex-column mb-3" style="height: 200px;"> + <div class="mb-auto p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> -<div class="d-flex align-items-end flex-column bd-highlight mb-3" style="height: 200px;"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="mt-auto p-2 bd-highlight">Flex item</div> +<div class="d-flex align-items-end flex-column mb-3" style="height: 200px;"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="mt-auto p-2">Flex item</div> </div> {{< /example >}} @@ -345,13 +345,13 @@ Vertically move one flex item to the top or bottom of a container by mixing `ali Change how flex items wrap in a flex container. Choose from no wrapping at all (the browser default) with `.flex-nowrap`, wrapping with `.flex-wrap`, or reverse wrapping with `.flex-wrap-reverse`. -<div class="bd-example"> - <div class="d-flex flex-nowrap bd-highlight" style="width: 8rem;"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex flex-nowrap" style="width: 8rem;"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -361,23 +361,23 @@ Change how flex items wrap in a flex container. Choose from no wrapping at all ( </div> ``` -<div class="bd-example"> - <div class="d-flex flex-wrap bd-highlight"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex flex-wrap"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -387,23 +387,23 @@ Change how flex items wrap in a flex container. Choose from no wrapping at all ( </div> ``` -<div class="bd-example"> - <div class="d-flex flex-wrap-reverse bd-highlight"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex flex-wrap-reverse"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -430,11 +430,11 @@ Responsive variations also exist for `flex-wrap`. Change the _visual_ order of specific flex items with a handful of `order` utilities. We only provide options for making an item first or last, as well as a reset to use the DOM order. As `order` takes any integer value from 0 to 5, add custom CSS for any additional values needed. -{{< example >}} -<div class="d-flex flex-nowrap bd-highlight"> - <div class="order-3 p-2 bd-highlight">First flex item</div> - <div class="order-2 p-2 bd-highlight">Second flex item</div> - <div class="order-1 p-2 bd-highlight">Third flex item</div> +{{< example class="bd-example-flex" >}} +<div class="d-flex flex-nowrap"> + <div class="order-3 p-2">First flex item</div> + <div class="order-2 p-2">Second flex item</div> + <div class="order-1 p-2">Third flex item</div> </div> {{< /example >}} @@ -468,23 +468,23 @@ Use `align-content` utilities on flexbox containers to align flex items *togethe **Heads up!** This property has no effect on single rows of flex items. -<div class="bd-example"> - <div class="d-flex align-content-start flex-wrap bd-highlight mb-3" style="height: 200px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-content-start flex-wrap mb-3" style="height: 200px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -494,23 +494,23 @@ Use `align-content` utilities on flexbox containers to align flex items *togethe </div> ``` -<div class="bd-example"> - <div class="d-flex align-content-end flex-wrap bd-highlight mb-3" style="height: 200px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-content-end flex-wrap mb-3" style="height: 200px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -518,23 +518,23 @@ Use `align-content` utilities on flexbox containers to align flex items *togethe <div class="d-flex align-content-end flex-wrap">...</div> ``` -<div class="bd-example"> - <div class="d-flex align-content-center flex-wrap bd-highlight mb-3" style="height: 200px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-content-center flex-wrap mb-3" style="height: 200px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -542,23 +542,23 @@ Use `align-content` utilities on flexbox containers to align flex items *togethe <div class="d-flex align-content-center flex-wrap">...</div> ``` -<div class="bd-example"> - <div class="d-flex align-content-between flex-wrap bd-highlight mb-3" style="height: 200px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-content-between flex-wrap mb-3" style="height: 200px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -566,23 +566,23 @@ Use `align-content` utilities on flexbox containers to align flex items *togethe <div class="d-flex align-content-between flex-wrap">...</div> ``` -<div class="bd-example"> - <div class="d-flex align-content-around flex-wrap bd-highlight mb-3" style="height: 200px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-content-around flex-wrap mb-3" style="height: 200px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> @@ -590,23 +590,23 @@ Use `align-content` utilities on flexbox containers to align flex items *togethe <div class="d-flex align-content-around flex-wrap">...</div> ``` -<div class="bd-example"> - <div class="d-flex align-content-stretch flex-wrap bd-highlight mb-3" style="height: 200px"> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> - <div class="p-2 bd-highlight">Flex item</div> +<div class="bd-example bd-example-flex"> + <div class="d-flex align-content-stretch flex-wrap mb-3" style="height: 200px"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> </div> </div> diff --git a/site/content/docs/5.1/utilities/position.md b/site/content/docs/5.1/utilities/position.md index 46e62dd36f..177464fa06 100644 --- a/site/content/docs/5.1/utilities/position.md +++ b/site/content/docs/5.1/utilities/position.md @@ -94,7 +94,7 @@ Here are some real life examples of these classes: </button> <button type="button" class="btn btn-dark position-relative"> - Marker <svg width="1em" height="1em" viewBox="0 0 16 16" class="position-absolute top-100 start-50 translate-middle mt-1 bi bi-caret-down-fill" fill="#212529" xmlns="http://www.w3.org/2000/svg"><path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg> + Marker <svg width="1em" height="1em" viewBox="0 0 16 16" class="position-absolute top-100 start-50 translate-middle mt-1" fill="#212529" xmlns="http://www.w3.org/2000/svg"><path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg> </button> <button type="button" class="btn btn-primary position-relative"> |