aboutsummaryrefslogtreecommitdiff
path: root/docs/utilities
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2017-05-26 22:28:09 -0700
committerMark Otto <[email protected]>2017-05-26 22:28:09 -0700
commit6c3f833076a9fa68601741e3e21bd07ad79b7d8a (patch)
treefe016946d77f9ffff15bbe9cdc593fd098b5bcc7 /docs/utilities
parentc581564a780974c6430ac5897740006f623f2277 (diff)
parent5d7db507396275fcda96935aff47b09e1d79ddc1 (diff)
downloadbootstrap-6c3f833076a9fa68601741e3e21bd07ad79b7d8a.tar.xz
bootstrap-6c3f833076a9fa68601741e3e21bd07ad79b7d8a.zip
Merge branch 'v4-docs-streamlined' of https://github.com/twbs/bootstrap into v4-docs-streamlined
Diffstat (limited to 'docs/utilities')
-rw-r--r--docs/utilities/borders.md29
-rw-r--r--docs/utilities/clearfix.md15
-rw-r--r--docs/utilities/flexbox.md523
-rw-r--r--docs/utilities/responsive-helpers.md6
-rw-r--r--docs/utilities/sizing-and-positioning.md24
-rw-r--r--docs/utilities/spacing.md35
-rw-r--r--docs/utilities/typography.md11
-rw-r--r--docs/utilities/vertical-align.md37
8 files changed, 645 insertions, 35 deletions
diff --git a/docs/utilities/borders.md b/docs/utilities/borders.md
index b47d95c97..1f092c36a 100644
--- a/docs/utilities/borders.md
+++ b/docs/utilities/borders.md
@@ -2,21 +2,37 @@
layout: docs
title: Borders
group: utilities
+redirect_from: "/utilities/"
---
Use border utilities to quickly style the `border` and `border-radius` of an element. Great for images, buttons, or any other element.
+## Border
+
+Add classes to an element to remove all borders or some borders.
+
+<div class="bd-example-border-utils">
+{% example html %}
+<span class="border-0"></span>
+<span class="border-top-0"></span>
+<span class="border-right-0"></span>
+<span class="border-bottom-0"></span>
+<span class="border-left-0"></span>
+{% endexample %}
+</div>
+
## Border-radius
Add classes to an element to easily round its corners.
<div class="bd-example bd-example-images">
- <img data-src="holder.js/100x100" class="rounded" alt="Example rounded image">
- <img data-src="holder.js/100x100" class="rounded-top" alt="Example top rounded image">
- <img data-src="holder.js/100x100" class="rounded-right" alt="Example right rounded image">
- <img data-src="holder.js/100x100" class="rounded-bottom" alt="Example bottom rounded image">
- <img data-src="holder.js/100x100" class="rounded-left" alt="Example left rounded image">
- <img data-src="holder.js/100x100" class="rounded-circle" alt="Completely round image">
+ <img data-src="holder.js/75x75" class="rounded" alt="Example rounded image">
+ <img data-src="holder.js/75x75" class="rounded-top" alt="Example top rounded image">
+ <img data-src="holder.js/75x75" class="rounded-right" alt="Example right rounded image">
+ <img data-src="holder.js/75x75" class="rounded-bottom" alt="Example bottom rounded image">
+ <img data-src="holder.js/75x75" class="rounded-left" alt="Example left rounded image">
+ <img data-src="holder.js/75x75" class="rounded-circle" alt="Completely round image">
+ <img data-src="holder.js/75x75" class="rounded-0" alt="Example non-rounded image (overrides rounding applied elsewhere)">
</div>
{% highlight html %}
@@ -26,4 +42,5 @@ Add classes to an element to easily round its corners.
<img src="..." alt="..." class="rounded-bottom">
<img src="..." alt="..." class="rounded-left">
<img src="..." alt="..." class="rounded-circle">
+<img src="..." alt="..." class="rounded-0">
{% endhighlight %}
diff --git a/docs/utilities/clearfix.md b/docs/utilities/clearfix.md
index e63ba3cda..49410df09 100644
--- a/docs/utilities/clearfix.md
+++ b/docs/utilities/clearfix.md
@@ -12,13 +12,10 @@ Easily clear `float`s by adding `.clearfix` **to the parent element**. Utilizes
{% highlight scss %}
// Mixin itself
-.clearfix() {
- &:before,
- &:after {
- content: " ";
- display: table;
- }
- &:after {
+@mixin clearfix() {
+ &::after {
+ display: block;
+ content: "";
clear: both;
}
}
@@ -33,7 +30,7 @@ The following example shows how the clearfix can be used. Without the clearfix t
{% example html %}
<div class="bg-info clearfix">
- <button class="btn btn-secondary float-xs-left">Example Button pulled left</button>
- <button class="btn btn-secondary float-xs-right">Example Button pullred right</button>
+ <button class="btn btn-secondary float-left">Example Button floated left</button>
+ <button class="btn btn-secondary float-right">Example Button floated right</button>
</div>
{% endexample %}
diff --git a/docs/utilities/flexbox.md b/docs/utilities/flexbox.md
new file mode 100644
index 000000000..9b6add5c4
--- /dev/null
+++ b/docs/utilities/flexbox.md
@@ -0,0 +1,523 @@
+---
+layout: docs
+title: Flexbox
+group: utilities
+---
+
+Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary.
+
+## Contents
+
+* Will be replaced with the ToC, excluding the "Contents" header
+{:toc}
+
+## Enable flex behaviors
+
+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 html %}
+<div class="d-flex p-2 bd-highlight">I'm a flexbox container!</div>
+{% endexample %}
+
+{% example html %}
+<div class="d-inline-flex p-2 bd-highlight">I'm an inline flexbox container!</div>
+{% endexample %}
+
+Responsive variations also exist for `.d-flex` and `.d-inline-flex`.
+
+{% for bp in site.data.breakpoints %}
+- `.d{{ bp.abbr }}-flex`
+- `.d{{ bp.abbr }}-inline-flex`{% endfor %}
+
+## Direction
+
+Set the direction of flex items in a flex container with direction utilities. In most cases you can omit the horizontal class here as the browser default is `row`. However, you may encounter situations where you needed to explicitly set this value (like responsive layouts).
+
+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 html %}
+<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>
+</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>
+{% endexample %}
+
+Use `.flex-column` to set a vertical direction, or `.flex-column-reverse` to start the vertical direction from the opposite side.
+
+{% example html %}
+<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>
+</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>
+{% endexample %}
+
+Responsive variations also exist for `flex-direction`.
+
+{% for bp in site.data.breakpoints %}
+- `.flex{{ bp.abbr }}-row`
+- `.flex{{ bp.abbr }}-row-reverse`
+- `.flex{{ bp.abbr }}-column`
+- `.flex{{ bp.abbr }}-column-reverse`{% endfor %}
+
+## Justify content
+
+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`, or `around`.
+
+<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>
+ <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>
+ <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>
+ <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>
+ <div class="d-flex justify-content-around 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>
+</div>
+
+{% highlight html %}
+<div class="d-flex justify-content-start">...</div>
+<div class="d-flex justify-content-end">...</div>
+<div class="d-flex justify-content-center">...</div>
+<div class="d-flex justify-content-between">...</div>
+<div class="d-flex justify-content-around">...</div>
+{% endhighlight %}
+
+Responsive variations also exist for `justify-content`.
+
+{% for bp in site.data.breakpoints %}
+- `.justify-content{{ bp.abbr }}-start`
+- `.justify-content{{ bp.abbr }}-end`
+- `.justify-content{{ bp.abbr }}-center`
+- `.justify-content{{ bp.abbr }}-between`
+- `.justify-content{{ bp.abbr }}-around`{% endfor %}
+
+## Align items
+
+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>
+ <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>
+ <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>
+ <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>
+ <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>
+</div>
+
+{% highlight html %}
+<div class="d-flex align-items-start">...</div>
+<div class="d-flex align-items-end">...</div>
+<div class="d-flex align-items-center">...</div>
+<div class="d-flex align-items-baseline">...</div>
+<div class="d-flex align-items-stretch">...</div>
+{% endhighlight %}
+
+Responsive variations also exist for `align-items`.
+
+{% for bp in site.data.breakpoints %}
+- `.align-items{{ bp.abbr }}-start`
+- `.align-items{{ bp.abbr }}-end`
+- `.align-items{{ bp.abbr }}-center`
+- `.align-items{{ bp.abbr }}-baseline`
+- `.align-items{{ bp.abbr }}-stretch`{% endfor %}
+
+## Align self
+
+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>
+ <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>
+ <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>
+ <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>
+ <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>
+</div>
+
+{% highlight html %}
+<div class="align-self-start">Aligned flex item</div>
+<div class="align-self-end">Aligned flex item</div>
+<div class="align-self-center">Aligned flex item</div>
+<div class="align-self-baseline">Aligned flex item</div>
+<div class="align-self-stretch">Aligned flex item</div>
+{% endhighlight %}
+
+Responsive variations also exist for `align-self`.
+
+{% for bp in site.data.breakpoints %}
+- `.align-self{{ bp.abbr }}-start`
+- `.align-self{{ bp.abbr }}-end`
+- `.align-self{{ bp.abbr }}-center`
+- `.align-self{{ bp.abbr }}-baseline`
+- `.align-self{{ bp.abbr }}-stretch`{% endfor %}
+
+## Auto margins
+
+Flexbox can do some pretty awesome things when you mix flex alignments with auto margins.
+
+### With justify-content
+
+Easily move all flex items to one side, but keep another on the opposite end by mixing `justify-content` with `margin-right: auto` or `margin-left: auto`.
+
+{% example html %}
+<div class="d-flex justify-content-end bd-highlight mb-3">
+ <div class="mr-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>
+
+<div class="d-flex justify-content-start bd-highlight">
+ <div class="p-2 bd-highlight">Flex item</div>
+ <div class="p-2 bd-highlight">Flex item</div>
+ <div class="ml-auto p-2 bd-highlight">Flex item</div>
+</div>
+{% endexample %}
+
+### With align-items
+
+Similarly, 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 html %}
+<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>
+</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>
+{% endexample %}
+
+## Wrap
+
+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">
+ <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>
+</div>
+{% highlight html %}
+<div class="d-flex flex-nowrap">
+ ...
+</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex flex-wrap">
+ ...
+</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex flex-wrap-reverse">
+ ...
+</div>
+{% endhighlight %}
+
+
+{% example html %}
+{% endexample %}
+
+Responsive variations also exist for `flex-wrap`.
+
+{% for bp in site.data.breakpoints %}
+- `.flex{{ bp.abbr }}-nowrap`
+- `.flex{{ bp.abbr }}-wrap`
+- `.flex{{ bp.abbr }}-wrap-reverse`{% endfor %}
+
+## Order
+
+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 (e.g., `5`), add custom CSS for any additional values needed.
+
+{% example html %}
+<div class="d-flex flex-nowrap bd-highlight">
+ <div class="flex-last p-2 bd-highlight">First flex item</div>
+ <div class="p-2 bd-highlight">Second flex item</div>
+ <div class="flex-first p-2 bd-highlight">Third flex item</div>
+</div>
+{% endexample %}
+
+Responsive variations also exist for `order`.
+
+{% for bp in site.data.breakpoints %}
+- `.order{{ bp.abbr }}-first`
+- `.order{{ bp.abbr }}-last`
+- `.order{{ bp.abbr }}-unordered`{% endfor %}
+
+## Align content
+
+Use `align-content` utilities on flexbox containers to align flex items *together* on the cross axis. Choose from `start` (browser default), `end`, `center`, `between`, `around`, or `stretch`. To demonstrate these utilities, we've enforced `flex-wrap: wrap` and increased the number of flex items.
+
+**Heads up!** This property has no affect 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>
+</div>
+{% highlight html %}
+<div class="d-flex align-content-start flex-wrap">
+ ...
+</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex align-content-end flex-wrap">...</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex align-content-center flex-wrap">...</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex align-content-between flex-wrap">...</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex align-content-around flex-wrap">...</div>
+{% endhighlight %}
+
+<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>
+</div>
+{% highlight html %}
+<div class="d-flex align-content-stretch flex-wrap">...</div>
+{% endhighlight %}
+
+Responsive variations also exist for `align-content`.
+
+{% for bp in site.data.breakpoints %}
+- `.align-content{{ bp.abbr }}-start`
+- `.align-content{{ bp.abbr }}-end`
+- `.align-content{{ bp.abbr }}-center`
+- `.align-content{{ bp.abbr }}-around`
+- `.align-content{{ bp.abbr }}-stretch`{% endfor %}
diff --git a/docs/utilities/responsive-helpers.md b/docs/utilities/responsive-helpers.md
index 13ae8a56d..35e7fcf2f 100644
--- a/docs/utilities/responsive-helpers.md
+++ b/docs/utilities/responsive-helpers.md
@@ -49,9 +49,9 @@ These utility classes float an element to the left or right, or disable floating
Two similar non-responsive Sass mixins (`float-left` and `float-right`) are also available.
{% example html %}
-<div class="float-xs-left">Float left on all viewport sizes</div><br>
-<div class="float-xs-right">Float right on all viewport sizes</div><br>
-<div class="float-xs-none">Don't float on all viewport sizes</div><br>
+<div class="float-left">Float left on all viewport sizes</div><br>
+<div class="float-right">Float right on all viewport sizes</div><br>
+<div class="float-none">Don't float on all viewport sizes</div><br>
<div class="float-sm-left">Float left on viewports sized SM (small) or wider</div><br>
<div class="float-md-left">Float left on viewports sized MD (medium) or wider</div><br>
diff --git a/docs/utilities/sizing-and-positioning.md b/docs/utilities/sizing-and-positioning.md
index 8881b177b..a6de778ca 100644
--- a/docs/utilities/sizing-and-positioning.md
+++ b/docs/utilities/sizing-and-positioning.md
@@ -21,14 +21,32 @@ The `.pos-f-t` class can be used to easily position elements at the top of the v
## Width and height
-Easily make an element as wide or as tall as its parent using the `.w-100` and `.h-100` utility classes.
+Easily make an element as wide or as tall (relative to its parent) with our width and height utilities. Includes support for `25%`, `50%`, `75%`, and `100%`.
{% example html %}
-<img class="w-100" data-src="holder.js/200px100?outline=yes&text=Width%20%3D%20100%25" alt="Width = 100%">
+<div class="w-25 p-3" style="background-color: #eee;">Width 25%</div>
+<div class="w-50 p-3" style="background-color: #eee;">Width 50%</div>
+<div class="w-75 p-3" style="background-color: #eee;">Width 75%</div>
+<div class="w-100 p-3" style="background-color: #eee;">Width 100%</div>
{% endexample %}
{% example html %}
<div style="height: 100px; background-color: rgba(255,0,0,0.1);">
- <div class="h-100" style="width: 100px; background-color: rgba(0,0,255,0.1);">Full height</div>
+ <div class="h-25 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 25%</div>
+ <div class="h-50 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 50%</div>
+ <div class="h-75 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 75%</div>
+ <div class="h-100 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 100%</div>
+</div>
+{% endexample %}
+
+You can also use `max-width: 100%;` and `max-height: 100%;` utilities as needed.
+
+{% example html %}
+<img class="mw-100" data-src="holder.js/1000px100?text=Max-width%20%3D%20100%25" alt="Max-width 100%">
+{% endexample %}
+
+{% example html %}
+<div style="height: 100px; background-color: rgba(255,0,0,0.1);">
+ <div class="mh-100" style="width: 100px; height: 200px; background-color: rgba(0,0,255,0.1);">Max-height 100%</div>
</div>
{% endexample %}
diff --git a/docs/utilities/spacing.md b/docs/utilities/spacing.md
index 1ee1ab7fb..0a5132941 100644
--- a/docs/utilities/spacing.md
+++ b/docs/utilities/spacing.md
@@ -4,9 +4,18 @@ title: Spacing
group: utilities
---
-Assign `margin` or `padding` to an element or a subset of its sides with shorthand classes. Includes support for individual properties, all properties, and vertical and horizontal properties. All classes are multiples on the global default value, `1rem`.
+Assign responsive-friendly `margin` or `padding` values to an element or a subset of its sides with shorthand classes. Includes support for individual properties, all properties, and vertical and horizontal properties. Classes are built from a default Sass map ranging from `.25rem` to `3rem`.
-The classes are named using the format: `{property}{sides}-{size}`
+## Contents
+
+* Will be replaced with the ToC, excluding the "Contents" header
+{:toc}
+
+## Notation
+
+Spacing utilities that apply to all breakpoints, from `xs` to `xl`, have no breakpoint abbreviation in them. This is because those classes are applied from `min-width: 0` and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.
+
+The classes are named using the format `{property}{sides}-{size}` for `xs` and `{property}{sides}-{breakpoint}-{size}` for `sm`, `md`, `lg`, and `xl`.
Where *property* is one of:
@@ -21,17 +30,21 @@ Where *sides* is one of:
* `r` - for classes that set `margin-right` or `padding-right`
* `x` - for classes that set both `*-left` and `*-right`
* `y` - for classes that set both `*-top` and `*-bottom`
-* `a` - for classes that set a `margin` or `padding` on all 4 sides of the element
+* blank - for classes that set a `margin` or `padding` on all 4 sides of the element
Where *size* is one of:
* `0` - for classes that eliminate the `margin` or `padding` by setting it to `0`
-* `1` - (by default) for classes that set the `margin` or `padding` to `$spacer-x` or `$spacer-y`
-* `2` - (by default) for classes that set the `margin` or `padding` to `$spacer-x * 1.5` or `$spacer-y * 1.5`
-* `3` - (by default) for classes that set the `margin` or `padding` to `$spacer-x * 3` or `$spacer-y * 3`
+* `1` - (by default) for classes that set the `margin` or `padding` to `$spacer-x * .25` or `$spacer-y * .25`
+* `2` - (by default) for classes that set the `margin` or `padding` to `$spacer-x * .5` or `$spacer-y * .5`
+* `3` - (by default) for classes that set the `margin` or `padding` to `$spacer-x` or `$spacer-y`
+* `4` - (by default) for classes that set the `margin` or `padding` to `$spacer-x * 1.5` or `$spacer-y * 1.5`
+* `5` - (by default) for classes that set the `margin` or `padding` to `$spacer-x * 3` or `$spacer-y * 3`
(You can add more sizes by adding entries to the `$spacers` Sass map variable.)
+## Examples
+
Here are some representative examples of these classes:
{% highlight scss %}
@@ -40,21 +53,21 @@ Here are some representative examples of these classes:
}
.ml-1 {
- margin-left: $spacer-x !important;
+ margin-left: ($spacer-x * .25) !important;
}
.px-2 {
- padding-left: ($spacer-x * 1.5) !important;
- padding-right: ($spacer-x * 1.5) !important;
+ padding-left: ($spacer-x * .5) !important;
+ padding-right: ($spacer-x * .5) !important;
}
.p-3 {
- padding: ($spacer-y * 3) ($spacer-x * 3) !important;
+ padding: $spacer-y $spacer-x !important;
}
{% endhighlight %}
### Horizontal centering
-Additionally, Bootstrap also includes an `.mx-auto` class for horizontally centering fixed-width block level content by setting the horizontal margins to `auto`.
+Additionally, Bootstrap also includes an `.mx-auto` class for horizontally centering fixed-width block level content—that is, content that has `display: block` and a `width` set—by setting the horizontal margins to `auto`.
<div class="bd-example">
<div class="mx-auto" style="width: 200px; background-color: rgba(86,61,124,.15);">
diff --git a/docs/utilities/typography.md b/docs/utilities/typography.md
index c5628dad1..42b61131e 100644
--- a/docs/utilities/typography.md
+++ b/docs/utilities/typography.md
@@ -6,6 +6,11 @@ group: utilities
The following utilities can be used to add additional styles to texts.
+## Contents
+
+* Will be replaced with the ToC, excluding the "Contents" header
+{:toc}
+
## Text alignment
Easily realign text to components with text alignment classes.
@@ -25,9 +30,9 @@ Easily realign text to components with text alignment classes.
For left, right, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.
{% example html %}
-<p class="text-xs-left">Left aligned text on all viewport sizes.</p>
-<p class="text-xs-center">Center aligned text on all viewport sizes.</p>
-<p class="text-xs-right">Right aligned text on all viewport sizes.</p>
+<p class="text-left">Left aligned text on all viewport sizes.</p>
+<p class="text-center">Center aligned text on all viewport sizes.</p>
+<p class="text-right">Right aligned text on all viewport sizes.</p>
<p class="text-sm-left">Left aligned text on viewports sized SM (small) or wider.</p>
<p class="text-md-left">Left aligned text on viewports sized MD (medium) or wider.</p>
diff --git a/docs/utilities/vertical-align.md b/docs/utilities/vertical-align.md
new file mode 100644
index 000000000..09ae115b0
--- /dev/null
+++ b/docs/utilities/vertical-align.md
@@ -0,0 +1,37 @@
+---
+layout: docs
+title: Vertical alignment
+group: utilities
+---
+
+Change the alignment of elements with the [`vertical-alignment`](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) utilities. Please note that vertical-align only affects inline, inline-block, inline-table, and table cell elements.
+
+Choose from `.align-baseline`, `.align-top`, `.align-middle`, `.align-bottom`, `.align-text-bottom`, and `.align-text-top` as needed.
+
+With inline elements:
+
+{% example html %}
+<span class="align-baseline">baseline</span>
+<span class="align-top">top</span>
+<span class="align-middle">middle</span>
+<span class="align-bottom">bottom</span>
+<span class="align-text-top">text-top</span>
+<span class="align-text-bottom">text-bottom</span>
+{% endexample %}
+
+With table cells:
+
+{% example html %}
+<table style="height: 100px;">
+ <tbody>
+ <tr>
+ <td class="align-baseline">baseline</td>
+ <td class="align-top">top</td>
+ <td class="align-middle">middle</td>
+ <td class="align-bottom">bottom</td>
+ <td class="align-text-top">text-top</td>
+ <td class="align-text-bottom">text-bottom</td>
+ </tr>
+ </tbody>
+</table>
+{% endexample %}