Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2020-05-13 22:36:00 +0300
committerGitHub <noreply@github.com>2020-05-13 22:36:00 +0300
commit38ec7c4df7a04b6942516669edb9517c9035dc1d (patch)
treee224c393d58ceeb993dede64e2e44962c99f1724 /site/content/docs/5.0/helpers
parentde7af5ee0738d08ef2d6702654834beb5bfce35e (diff)
Bump version to 5.0.0-alpha1 (#29925)
Also add v4.5.0 in versions and keep README.md pointing to v4.5.0 so that there are no broken stuff.
Diffstat (limited to 'site/content/docs/5.0/helpers')
-rw-r--r--site/content/docs/5.0/helpers/clearfix.md36
-rw-r--r--site/content/docs/5.0/helpers/colored-links.md17
-rw-r--r--site/content/docs/5.0/helpers/embed.md53
-rw-r--r--site/content/docs/5.0/helpers/position.md42
-rw-r--r--site/content/docs/5.0/helpers/screen-readers.md25
-rw-r--r--site/content/docs/5.0/helpers/stretched-link.md75
-rw-r--r--site/content/docs/5.0/helpers/text-truncation.md23
7 files changed, 271 insertions, 0 deletions
diff --git a/site/content/docs/5.0/helpers/clearfix.md b/site/content/docs/5.0/helpers/clearfix.md
new file mode 100644
index 0000000000..344a577fd7
--- /dev/null
+++ b/site/content/docs/5.0/helpers/clearfix.md
@@ -0,0 +1,36 @@
+---
+layout: docs
+title: Clearfix
+description: Quickly and easily clear floated content within a container by adding a clearfix utility.
+group: helpers
+aliases: "/docs/5.0/helpers/"
+---
+
+Easily clear `float`s by adding `.clearfix` **to the parent element**. Can also be used as a mixin.
+
+Use in HTML:
+
+{{< highlight html >}}
+<div class="clearfix">...</div>
+{{< /highlight >}}
+
+The mixin source code:
+
+{{< scss-docs name="clearfix" file="scss/mixins/_clearfix.scss" >}}
+
+Use the mixin in SCSS:
+
+{{< highlight scss >}}
+.element {
+ @include clearfix;
+}
+{{< /highlight >}}
+
+The following example shows how the clearfix can be used. Without the clearfix the wrapping div would not span around the buttons which would cause a broken layout.
+
+{{< example >}}
+<div class="bg-info clearfix">
+ <button type="button" class="btn btn-secondary float-left">Example Button floated left</button>
+ <button type="button" class="btn btn-secondary float-right">Example Button floated right</button>
+</div>
+{{< /example >}}
diff --git a/site/content/docs/5.0/helpers/colored-links.md b/site/content/docs/5.0/helpers/colored-links.md
new file mode 100644
index 0000000000..f75cae4275
--- /dev/null
+++ b/site/content/docs/5.0/helpers/colored-links.md
@@ -0,0 +1,17 @@
+---
+layout: docs
+title: Colored links
+description: Colored links with hover states
+group: helpers
+toc: false
+---
+
+You can use the `.link-*` classes to colorize links. Unlike the [`.text-*` classes]({{< docsref "/utilities/colors#colors" >}}), these classes have a `:hover` and `:focus` state.
+
+{{< example >}}
+{{< colored-links.inline >}}
+{{- range (index $.Site.Data "theme-colors") }}
+<a href="#" class="link-{{ .name }}">{{ .name | title }} link</a>
+{{- end -}}
+{{< /colored-links.inline >}}
+{{< /example >}}
diff --git a/site/content/docs/5.0/helpers/embed.md b/site/content/docs/5.0/helpers/embed.md
new file mode 100644
index 0000000000..78d3f265d0
--- /dev/null
+++ b/site/content/docs/5.0/helpers/embed.md
@@ -0,0 +1,53 @@
+---
+layout: docs
+title: Embeds
+description: Create responsive video or slideshow embeds based on the width of the parent by creating an intrinsic ratio that scales on any device.
+group: helpers
+toc: true
+---
+
+## About
+
+Rules are directly applied to `<iframe>`, `<embed>`, `<video>`, and `<object>` elements; optionally use an explicit descendant class `.embed-responsive-item` when you want to match the styling for other attributes.
+
+**Pro-Tip!** You don't need to include `frameborder="0"` in your `<iframe>`s as we override that for you in [reboot]({{< docsref "/content/reboot" >}}).
+
+## Example
+
+Wrap any embed like an `<iframe>` in a parent element with `.embed-responsive` and an aspect ratio. The `.embed-responsive-item` isn't strictly required, but we encourage it.
+
+{{< example >}}
+<div class="embed-responsive embed-responsive-16by9">
+ <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" title="YouTube video" allowfullscreen></iframe>
+</div>
+{{< /example >}}
+
+## Aspect ratios
+
+Aspect ratios can be customized with modifier classes. By default the following ratio classes are provided:
+
+{{< highlight html >}}
+<!-- 21:9 aspect ratio -->
+<div class="embed-responsive embed-responsive-21by9">
+ <iframe class="embed-responsive-item" src="..."></iframe>
+</div>
+
+<!-- 16:9 aspect ratio -->
+<div class="embed-responsive embed-responsive-16by9">
+ <iframe class="embed-responsive-item" src="..."></iframe>
+</div>
+
+<!-- 4:3 aspect ratio -->
+<div class="embed-responsive embed-responsive-4by3">
+ <iframe class="embed-responsive-item" src="..."></iframe>
+</div>
+
+<!-- 1:1 aspect ratio -->
+<div class="embed-responsive embed-responsive-1by1">
+ <iframe class="embed-responsive-item" src="..."></iframe>
+</div>
+{{< /highlight >}}
+
+Within `_variables.scss`, you can change the aspect ratios you want to use. Here's an example of the `$embed-responsive-aspect-ratios` map:
+
+{{< scss-docs name="embed-responsive-aspect-ratios" file="scss/_variables.scss" >}}
diff --git a/site/content/docs/5.0/helpers/position.md b/site/content/docs/5.0/helpers/position.md
new file mode 100644
index 0000000000..ef7ab0dfc3
--- /dev/null
+++ b/site/content/docs/5.0/helpers/position.md
@@ -0,0 +1,42 @@
+---
+layout: docs
+title: Position
+description: Use these helpers for quickly configuring the position of an element.
+group: helpers
+toc: true
+---
+
+## Fixed top
+
+Position an element at the top of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.
+
+{{< highlight html >}}
+<div class="fixed-top">...</div>
+{{< /highlight >}}
+
+## Fixed bottom
+
+Position an element at the bottom of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.
+
+{{< highlight html >}}
+<div class="fixed-bottom">...</div>
+{{< /highlight >}}
+
+## Sticky top
+
+Position an element at the top of the viewport, from edge to edge, but only after you scroll past it. The `.sticky-top` utility uses CSS's `position: sticky`, which isn't fully supported in all browsers.
+
+{{< highlight html >}}
+<div class="sticky-top">...</div>
+{{< /highlight >}}
+
+## Responsive sticky top
+
+Responsive variations also exist for `.sticky-top` utility.
+
+{{< highlight html >}}
+<div class="sticky-sm-top">Stick to the top on viewports sized SM (small) or wider</div>
+<div class="sticky-md-top">Stick to the top on viewports sized MD (medium) or wider</div>
+<div class="sticky-lg-top">Stick to the top on viewports sized LG (large) or wider</div>
+<div class="sticky-xl-top">Stick to the top on viewports sized XL (extra-large) or wider</div>
+{{< /highlight >}}
diff --git a/site/content/docs/5.0/helpers/screen-readers.md b/site/content/docs/5.0/helpers/screen-readers.md
new file mode 100644
index 0000000000..501b9c311c
--- /dev/null
+++ b/site/content/docs/5.0/helpers/screen-readers.md
@@ -0,0 +1,25 @@
+---
+layout: docs
+title: Screen readers
+description: Use screen reader utilities to hide elements on all devices except screen readers.
+group: helpers
+---
+
+Hide an element to all devices **except screen readers** with `.sr-only`. Use `.sr-only-focusable` to show the element only when it's focused (e.g. by a keyboard-only user). Can also be used as mixins.
+
+{{< example >}}
+<h2 class="sr-only">Title for screen readers</h2>
+<a class="sr-only-focusable" href="#content">Skip to main content</a>
+{{< /example >}}
+
+{{< highlight scss >}}
+// Usage as a mixin
+
+.sr-only-title {
+ @include sr-only;
+}
+
+.skip-navigation {
+ @include sr-only-focusable;
+}
+{{< /highlight >}}
diff --git a/site/content/docs/5.0/helpers/stretched-link.md b/site/content/docs/5.0/helpers/stretched-link.md
new file mode 100644
index 0000000000..4702291def
--- /dev/null
+++ b/site/content/docs/5.0/helpers/stretched-link.md
@@ -0,0 +1,75 @@
+---
+layout: docs
+title: Stretched link
+description: Make any HTML element or Bootstrap component clickable by "stretching" a nested link via CSS.
+group: helpers
+---
+
+Add `.stretched-link` to a link to make its [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block) clickable via a `::after` pseudo element. In most cases, this means that an element with `position: relative;` that contains a link with the `.stretched-link` class is clickable.
+
+Cards have `position: relative` by default in Bootstrap, so in this case you can safely add the `.stretched-link` class to a link in the card without any other HTML changes.
+
+Multiple links and tap targets are not recommended with stretched links. However, some `position` and `z-index` styles can help should this be required.
+
+{{< example >}}
+<div class="card" style="width: 18rem;">
+ {{< placeholder width="100%" height="180" class="card-img-top" text="false" title="Card image cap" >}}
+ <div class="card-body">
+ <h5 class="card-title">Card with stretched link</h5>
+ <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ <a href="#" class="btn btn-primary stretched-link">Go somewhere</a>
+ </div>
+</div>
+{{< /example >}}
+
+Most custom components do not have `position: relative` by default, so we need to add the `.position-relative` here to prevent the link from stretching outside the parent element.
+
+{{< example >}}
+<div class="d-flex position-relative">
+ {{< placeholder width="144" height="144" class="flex-shrink-0 mr-3" text="false" title="Generic placeholder image" >}}
+ <div>
+ <h5 class="mt-0">Custom component with stretched link</h5>
+ <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p>
+ <a href="#" class="stretched-link">Go somewhere</a>
+ </div>
+</div>
+{{< /example >}}
+
+
+{{< example >}}
+<div class="row g-0 bg-light position-relative">
+ <div class="col-md-6 mb-md-0 p-md-4">
+ {{< placeholder width="100%" height="200" class="w-100" text="false" title="Generic placeholder image" >}}
+ </div>
+ <div class="col-md-6 p-4 pl-md-0">
+ <h5 class="mt-0">Columns with stretched link</h5>
+ <p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.</p>
+ <a href="#" class="stretched-link">Go somewhere</a>
+ </div>
+</div>
+{{< /example >}}
+
+## Identifying the containing block
+
+If the stretched link doesn't seem to work, the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#Identifying_the_containing_block) will probably be the cause. The following CSS properties will make an element the containing block:
+
+- A `position` value other than `static`
+- A `transform` or `perspective` value other than `none`
+- A `will-change` value of `transform` or `perspective`
+- A `filter` value other than `none` or a `will-change` value of `filter` (only works on Firefox)
+
+{{< example >}}
+<div class="card" style="width: 18rem;">
+ {{< placeholder width="100%" height="180" class="card-img-top" text="false" title="Card image cap" >}}
+ <div class="card-body">
+ <h5 class="card-title">Card with stretched links</h5>
+ <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ <p class="card-text">
+ <a href="#" class="stretched-link text-danger" style="position: relative;">Stretched link will not work here, because <code>position: relative</code> is added to the link</a>
+ </p>
+ <p class="card-text bg-light" style="transform: rotate(0);">
+ This <a href="#" class="text-warning stretched-link">stretched link</a> will only be spread over the <code>p</code>-tag, because a transform is applied to it.
+ </p>
+ </div>
+</div>
+{{< /example >}}
diff --git a/site/content/docs/5.0/helpers/text-truncation.md b/site/content/docs/5.0/helpers/text-truncation.md
new file mode 100644
index 0000000000..a92a171fd1
--- /dev/null
+++ b/site/content/docs/5.0/helpers/text-truncation.md
@@ -0,0 +1,23 @@
+---
+layout: docs
+title: Text truncation
+description: Truncate long strings of text with an ellipsis.
+group: helpers
+toc: false
+---
+
+For longer content, you can add a `.text-truncate` class to truncate the text with an ellipsis. **Requires `display: inline-block` or `display: block`.**
+
+{{< example >}}
+<!-- Block level -->
+<div class="row">
+ <div class="col-2 text-truncate">
+ Praeterea iter est quasdam res quas ex communi.
+ </div>
+</div>
+
+<!-- Inline level -->
+<span class="d-inline-block text-truncate" style="max-width: 150px;">
+ Praeterea iter est quasdam res quas ex communi.
+</span>
+{{< /example >}}