How to Flow Text Around Shapes in CSS

Use the shape-outside property in CSS to flow text around elements. You can also use a polygon for more complex shapes:

.cirlce {
    shape-outside: circle(50%);
    width: 100px;
    height: 100px;
}
shape-outside.css
Copied to clipboard!

In the example above, this will create a circle to wrap around the text. By default, text is wrapped around its margin box. With shape-outside, you can define custom objects to wrap around. To create more complex objects, you can define a polygon or a path:

.shape-outside {
    shape-outside: polygon(10px 10px, 20px 20px, 30px 30px);
    shape-outside: path('path-rule');
}
shape-outside.css
Copied to clipboard!

You can also provide a URL for an image to be used. Make sure it is a png.

.shape-outside {
    shape-outside: url(circle.png);
}
shape-outside.css
Copied to clipboard!
How to flow text around shapes in CSS
If you would like to see more Webtips, follow @flowforfrank

10 Best Practices for Quickly Improving Your CSS

Resources:

Remove ads
Remove ads

📚 Get access to exclusive content

Want to get access to exclusive content? Support webtips with the price of a coffee to get access to tips, checklists, cheatsheets, and much more. ☕

Get access Support us
Remove ads Read more on
Remove ads
Remove ads
🎉 Thank you for subscribing to our newsletter. x This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.