CSS Portal

CSS shape-outside Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The shape-outside property controls the contour that inline content (text and inline-level boxes) flows around when it is applied to a floated element. It does not change the floated element’s own box, positioning, hit-testing area, stacking context, or how that element paints; its role is strictly to define the outline used when computing the float’s wrap area. Because it only affects the wrapping geometry, it must be used on an element that participates as a float — see float for how an element becomes a float.

Unlike a simple rectangular wrap determined by the element’s margin box, the property can specify more complex contours — geometric shapes, polygonal paths, or silhouettes derived from a visual resource — so nearby inline content conforms to that contour instead of the rectangle. The computed shape is evaluated relative to the float’s margin box and becomes the basis for line-breaking and inline box placement adjacent to the float. You can control spacing between the shape and surrounding content independently, for which the related shape-margin property is used to increase the gap around the defined contour without altering the contour itself.

It’s important to distinguish the wrapping contour from visual clipping or masking: a clipping or mask operation alters what parts of an element are painted and can affect hit-testing, whereas the wrapping contour solely affects the flow of inline content. For that distinction see clip-path. In practice, developers often combine wrapping contours with visual clipping or images — for example using an image’s nontransparent silhouette to determine the wrap — but remember that wrapping behavior depends on the float being present and the float’s box model; if the float isn’t participating in layout the shape has no effect.

When using contours in production layouts, watch for responsive and typographic interactions: different viewport widths, font sizes, line-heights, and column configurations change how many lines will sit beside the float and can reveal awkward gaps or overlaps if the contour and surrounding spacing aren’t tuned. Also keep accessibility and reading order in mind: shaping is a presentational device for flow, not a way to reorder content, and overly decorative shapes can make adjacent text harder to scan.

Definition

Initial value
none
Applies to
Floats
Inherited
No
Computed value
as defined for <basic-shape> (with <shape-box> following, if supplied); else the computed <image>; else the keyword as specified
Animatable
Yes
JavaScript syntax
object.style.shapeOutside

Syntax

shape-outside: none | [ <basic-shape> || <shape-box> ] | <image>

Values

  • noneThe float area is unaffected.
  • <basic-shape>The shape is computed based on the values of one of inset, circle, ellipse or polygon. If shape-box is not supplied, then the reference box defaults to margin-box.
  • <shape-box>The shape is defined by the CSS Box Model of the element the shape is applied to: margin-box, border-box, padding-box or content-box
  • <image>If <image> references an image, the shape is extracted and computed based on the alpha channel of the image as defined by shape-image-threshold. If <image> does not reference an image or if the fetch attempt results in any error such that there is no fallback image, the effect is as if the value auto had been specified.

Example

<div class="container">
<div class="float-shape" aria-hidden="true"></div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vitae eros ac arcu
mattis luctus. Integer euismod, nisl vitae facilisis cursus, orci sapien sodales
magna, a tincidunt nunc arcu in dolor. Curabitur in nibh vitae nisl tincidunt
vulputate. Suspendisse potenti. Sed sed nunc id nunc gravida ultricies. Phasellus
sagittis, nibh non pulvinar pretium, sapien justo fermentum justo, ac volutpat lectus
mi quis libero.
</p>
</div>
/* Basic page */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  padding: 32px;
  background: #f7f7fb;
  color: #222;
}

/* Container to constrain width */
.container {
  max-width: 760px;
  margin: 0 auto;
}

/* Float block that defines the wrapping shape */
.float-shape {
  float: left;
  width: 220px;
  height: 220px;
  margin: 12px 20px 12px 0;
  background: radial-gradient(circle at center, #ffb3b3 0%, #ff4d4d 100%);
  border-radius: 50%;
  /* The shape that text will wrap around */
  shape-outside: circle(50% at 50% 50%);
  -webkit-shape-outside: circle(50% at 50% 50%);
  shape-margin: 12px;
  -webkit-shape-margin: 12px;
}

/* Make paragraph easier to read */
p {
  text-align: justify;
  line-height: 1.6;
  margin: 0;
}

Browser Support

The following information will show you the current browser support for the CSS shape-outside property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!