Floats

Single purpose classes for setting the display of an element at any breakpoint.

Floats may be set on any element, but it will only affect elements that aren’t absolutely positioned. When you float an element you inherently set its display to block.

There are only three values that can be declared for float: left, right, or none. These three base classes are very easy to memorize: fl, fr, fn. Combine float left/right with width utilities to create fluid multi-column layouts.

Examples

Float Left

Float Left

Float Right

Float Right

Float None

Float None

Float With Images

Originally floats were used to wrap text around images as in the example below.

example 1

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Previous

Spacing

Next

Clearfix

Reference

MDN - Floats

tachyons-floats

v3.0.5 176 B
Declarations
16
Selectors
20
Max. Specificity Score
10
Size of Avg. Rule
1
src/_floats.css

/*

   FLOATS
   http://tachyons.io/docs/layout/floats/

   1. Floated elements are automatically rendered as block level elements.
      Setting floats to display inline will fix the double margin bug in
      ie6. You know... just in case.

   2. Don't forget to clearfix your floats with .cf

   Base:
     f = float

   Modifiers:
     l = left
     r = right
     n = none

   Media Query Extensions:
     -ns = not-small
     -m  = medium
     -l  = large

*/



.fl { float: left;  _display: inline; }
.fr { float: right; _display: inline; }
.fn { float: none; }

@media (--breakpoint-not-small) {
  .fl-ns { float: left; _display: inline; }
  .fr-ns { float: right; _display: inline; }
  .fn-ns { float: none; }
}

@media (--breakpoint-medium) {
  .fl-m { float: left; _display: inline; }
  .fr-m { float: right; _display: inline; }
  .fn-m { float: none; }
}

@media (--breakpoint-large) {
  .fl-l { float: left; _display: inline; }
  .fr-l { float: right; _display: inline; }
  .fn-l { float: none; }
}