1 |
efrain |
1 |
---
|
|
|
2 |
layout: docs
|
|
|
3 |
title: Float
|
|
|
4 |
description: Toggle floats on any element, across any breakpoint, using our responsive float utilities.
|
|
|
5 |
group: utilities
|
|
|
6 |
toc: true
|
|
|
7 |
---
|
|
|
8 |
|
|
|
9 |
## Overview
|
|
|
10 |
|
|
|
11 |
These utility classes float an element to the left or right, or disable floating, based on the current viewport size using the [CSS `float` property](https://developer.mozilla.org/en-US/docs/Web/CSS/float). `!important` is included to avoid specificity issues. These use the same viewport breakpoints as our grid system. Please be aware float utilities have no effect on flex items.
|
|
|
12 |
|
|
|
13 |
## Classes
|
|
|
14 |
|
|
|
15 |
Toggle a float with a class:
|
|
|
16 |
|
|
|
17 |
{{< example >}}
|
|
|
18 |
<div class="float-left">Float left on all viewport sizes</div><br>
|
|
|
19 |
<div class="float-right">Float right on all viewport sizes</div><br>
|
|
|
20 |
<div class="float-none">Don't float on all viewport sizes</div>
|
|
|
21 |
{{< /example >}}
|
|
|
22 |
|
|
|
23 |
## Mixins
|
|
|
24 |
|
|
|
25 |
Or by Sass mixin:
|
|
|
26 |
|
|
|
27 |
```scss
|
|
|
28 |
.element {
|
|
|
29 |
@include float-left;
|
|
|
30 |
}
|
|
|
31 |
.another-element {
|
|
|
32 |
@include float-right;
|
|
|
33 |
}
|
|
|
34 |
.one-more {
|
|
|
35 |
@include float-none;
|
|
|
36 |
}
|
|
|
37 |
```
|
|
|
38 |
|
|
|
39 |
## Responsive
|
|
|
40 |
|
|
|
41 |
Responsive variations also exist for each `float` value.
|
|
|
42 |
|
|
|
43 |
{{< example >}}
|
|
|
44 |
<div class="float-sm-left">Float left on viewports sized SM (small) or wider</div><br>
|
|
|
45 |
<div class="float-md-left">Float left on viewports sized MD (medium) or wider</div><br>
|
|
|
46 |
<div class="float-lg-left">Float left on viewports sized LG (large) or wider</div><br>
|
|
|
47 |
<div class="float-xl-left">Float left on viewports sized XL (extra-large) or wider</div><br>
|
|
|
48 |
{{< /example >}}
|
|
|
49 |
|
|
|
50 |
Here are all the support classes;
|
|
|
51 |
|
|
|
52 |
{{< markdown >}}
|
|
|
53 |
{{< float.inline >}}
|
|
|
54 |
{{- range $.Site.Data.breakpoints }}
|
|
|
55 |
- `.float{{ .abbr }}-left`
|
|
|
56 |
- `.float{{ .abbr }}-right`
|
|
|
57 |
- `.float{{ .abbr }}-none`
|
|
|
58 |
{{- end -}}
|
|
|
59 |
{{< /float.inline >}}
|
|
|
60 |
{{< /markdown >}}
|