mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-17 19:21:23 +03:00
docs: switch to fenced codeblocks (#31806)
This commit is contained in:
@@ -10,9 +10,9 @@ Easily clear `float`s by adding `.clearfix` **to the parent element**. Can also
|
||||
|
||||
Use in HTML:
|
||||
|
||||
{{< highlight html >}}
|
||||
```html
|
||||
<div class="clearfix">...</div>
|
||||
{{< /highlight >}}
|
||||
```
|
||||
|
||||
The mixin source code:
|
||||
|
||||
@@ -20,11 +20,11 @@ The mixin source code:
|
||||
|
||||
Use the mixin in SCSS:
|
||||
|
||||
{{< highlight scss >}}
|
||||
```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.
|
||||
|
||||
|
||||
@@ -10,33 +10,33 @@ toc: true
|
||||
|
||||
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 >}}
|
||||
```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 >}}
|
||||
```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 >}}
|
||||
```html
|
||||
<div class="sticky-top">...</div>
|
||||
{{< /highlight >}}
|
||||
```
|
||||
|
||||
## Responsive sticky top
|
||||
|
||||
Responsive variations also exist for `.sticky-top` utility.
|
||||
|
||||
{{< highlight html >}}
|
||||
```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 >}}
|
||||
```
|
||||
|
||||
@@ -59,13 +59,13 @@ For example, to create a 2x1 aspect ratio, set `--aspect-ratio: 50%` on the `.ra
|
||||
|
||||
This CSS variable makes it easy to modify the aspect ratio across breakpoints. The following is 4x3 to start, but changes to a custom 2x1 at the medium breakpoint.
|
||||
|
||||
{{< highlight scss >}}
|
||||
```scss
|
||||
.ratio-4x3 {
|
||||
@include media-breakpoint-up(md) {
|
||||
--aspect-ratio: 50%; // 2x1
|
||||
}
|
||||
}
|
||||
{{< /highlight >}}
|
||||
```
|
||||
|
||||
{{< example class="bd-example-ratios bd-example-ratios-breakpoint" >}}
|
||||
<div class="ratio ratio-4x3">
|
||||
|
||||
@@ -13,7 +13,7 @@ Visually hide an element while still allowing it to be exposed to assistive tech
|
||||
<a class="visually-hidden-focusable" href="#content">Skip to main content</a>
|
||||
{{< /example >}}
|
||||
|
||||
{{< highlight scss >}}
|
||||
```scss
|
||||
// Usage as a mixin
|
||||
|
||||
.visually-hidden-title {
|
||||
@@ -23,4 +23,4 @@ Visually hide an element while still allowing it to be exposed to assistive tech
|
||||
.skip-navigation {
|
||||
@include visually-hidden-focusable;
|
||||
}
|
||||
{{< /highlight >}}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user