Web design and digital-business ideas grounded in real tasks.

CSS shape-outside lets text wrap around an image’s contour

A web design desk with a circular photo print and a page mockup, text shown only as blurred strokes.
AI-generated photographic illustration; not documentary photography.

A circular portrait can still leave a rectangular gap in a page. Rounding its visible corners changes the picture, but it does not necessarily change the boundary that nearby text follows.

CSS shape-outside provides a wrapping shape for a floated element. The adjacent inline content can then follow that contour. MDN’s property reference describes basic shapes, reference boxes and image-based shapes; the float requirement is an essential part of the setup.

Give the wrapping and the picture their own jobs

For an illustrative circular portrait, begin with a square image box floated to the left. Set a circular wrapping shape and, separately, round the image itself. A small shape margin keeps words from touching the contour.

.portrait {
  float: left;
  width: 9rem;
  height: 9rem;
  object-fit: cover;
  border-radius: 50%;
  shape-outside: circle(50%);
  shape-margin: 1rem;
}
.article-intro {
  display: flow-root;
}

This example is a starting point for a local preview. The containing element establishes a new formatting context so that the float remains part of the introduction’s layout. It does not prove that every portrait crop or paragraph length will be comfortable to read.

The image still needs appropriate alternative text based on its purpose. Decorative layout does not replace the ordinary decisions about document structure or image meaning.

Test the shortest lines

Resize the preview and enlarge the text. At a narrow width, the remaining space beside the portrait can become a column of isolated words. In that case, remove the float at a suitable breakpoint and let the image sit above the paragraph. Choose the breakpoint from the actual content rather than from a device label alone.

Also check what happens after the paragraph ends. A short introduction followed by a heading can expose a float-clearing problem that a long demonstration paragraph hides.

If using an image’s transparency to define the wrapping shape, read the extra image and cross-origin requirements in the reference. A basic circle is often easier to inspect first. Keep a conventional layout available if the decorative effect does not improve the page’s reading rhythm.