Float

Float utilities control how an element flows beside surrounding content. In modern UI layouts, Flexbox and Grid should be used for most page structure. Float is still useful for editorial layouts, media wrapping, legacy content patterns, and small inline composition cases where text should flow around an element.

FrontAlign uses logical float values instead of physical left and right directions. That means float-start and float-end work correctly across both LTR and RTL interfaces.

All float utilities are pure CSS and do not require the FrontAlign runtime.


Quick reference

GroupClassesEffectCommon use
Float

float-start, float-end, float-none

float: inline-start | inline-end | noneMedia wrapping, pull quotes, editorial layouts.
Clearfixclearfix::after — display: block; clear: bothContain floated children inside a parent.
Responsive md

md:float-start, md:float-end, md:float-none

768px+Float on tablet and above, stack on mobile.
Responsive lg

lg:float-start, lg:float-end, lg:float-none

1024px+Float on desktop and above, stack on smaller screens.

Usage

<img src="/author.jpg" class="float-start rounded-circle" alt="Author photo" />

<p>
  This paragraph will naturally wrap around the floated image. This is useful for
  article introductions, editorial layouts, profile snippets, and content-heavy
  pages where media should sit inside the text flow.
</p>

Logical direction

FrontAlign uses logical CSS instead of hardcoded left and right. In LTR layouts float-start behaves like left. In RTL layouts it follows the writing direction automatically.

.float-start {
  float: inline-start;
}

.float-end {
  float: inline-end;
}

Float start

<article>
  <img src="/article-cover.jpg" class="float-start rounded-3" alt="Article cover" />

  <p>
    FrontAlign utilities are designed to be small, predictable, and readable.
    Floating an image allows long-form text to wrap naturally around media
    without creating a full layout system.
  </p>

  <p>
    This pattern is useful for blog posts, editorial sections, magazine-style
    pages, documentation callouts, and content previews.
  </p>
</article>

Float end

<article>
  <img src="/product.jpg" class="float-end rounded-3" alt="Product preview" />

  <p>
    Use <code>float-end</code> when the visual element should sit on the ending
    side of the text flow. This is useful for product previews, diagrams, quotes,
    and secondary media.
  </p>
</article>

Clearfix

Floated children are removed from the normal document flow. If a parent contains only floated children, its height may collapse. Use clearfix on the parent to contain floated elements properly.

.clearfix::after {
  display: block;
  clear: both;
  content: "";
}
<div class="clearfix">
  <img src="/avatar.jpg" class="float-start rounded-circle" alt="Avatar" />

  <p>
    The parent keeps its correct height because clearfix clears the floated
    content after it.
  </p>
</div>

Float utilities

ClassCSSRecommended use
float-startfloat: inline-startFloat an element to the start side of the writing direction.
float-endfloat: inline-endFloat an element to the end side of the writing direction.
float-nonefloat: noneRemove float behavior.

Responsive float utilities

ClassBreakpointCSS
md:float-start768px+float: inline-start
md:float-end768px+float: inline-end
md:float-none768px+float: none
lg:float-start1024px+float: inline-start
lg:float-end1024px+float: inline-end
lg:float-none1024px+float: none

Real-world examples

Responsive article media

<article class="clearfix">
  <img
    src="/editorial.jpg"
    class="float-none md:float-start rounded-3"
    alt="Editorial image"
  />

  <p>
    On small screens, the image stays in the normal document flow. From the
    medium breakpoint, it floats to the start side and lets text wrap around it.
  </p>
</article>

Remove float at larger screens

<div class="clearfix">
  <aside class="float-end lg:float-none">
    Related links
  </aside>

  <p>
    The aside can float on smaller content layouts and return to normal flow
    on larger layouts where Grid or Flexbox may take over.
  </p>
</div>

Media object pattern

<div class="clearfix border rounded-3">
  <img src="/profile.jpg" class="float-start rounded-circle" alt="Profile" />

  <h3>Design Engineer</h3>
  <p>
    Float can be useful for compact profile cards where a small image should
    sit beside short text content without requiring a full flex layout.
  </p>
</div>

Pull quote pattern

<article class="clearfix">
  <blockquote class="float-end border-start border-primary">
    Build interfaces with structure, speed, and freedom.
  </blockquote>

  <p>
    Pull quotes are a classic editorial use case for float utilities. They let
    the quote sit beside the article text while the content continues naturally.
  </p>
</article>

Choosing the right utility

Use caseRecommended tool
Text wrapping around imagesfloat-start or float-end
Navigation barsis-flex
Cards, columns, dashboardsis-grid
Legacy article layoutsfloat-start + clearfix
Precise responsive page structureis-grid or is-flex
Editorial pull quote beside textfloat-end + clearfix

Usage notes

  • Use float only when content should wrap around an element. For application layouts, navigation, dashboards, pricing sections, and component alignment, prefer Flexbox or Grid.
  • Always use clearfix on a parent that contains only floated children — without it the parent height will collapse to zero.
  • Prefer float-start and float-end over physical left/right naming — they respect the writing direction and work correctly in RTL interfaces.
  • Use responsive float utilities (md:float-start, lg:float-none) when an image should stack normally on mobile but float beside content on larger screens.
  • Float removes an element from normal document flow — surrounding block-level siblings will not see it unless clearfix or overflow: hidden is applied to the parent.
  • Do not combine float with Flexbox or Grid on the same element — they conflict and produce unpredictable layout results.

FrontAlign