Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

CSS Shapes – Non‑Rectangular | CSS Basics to Advanced lesson | BraveProgrammer
  1. Courses
  2. /
  3. CSS Basics to Advanced

Lesson 31 of 50

·css

CSS Shapes – Non‑Rectangular Layout

8 mins

Course progress62%

What you'll learn

Keep this idea in mind as you work through the lesson.

1 point
  • `clip-path` visually crops the element; `shape-outside` determines the text flow. * Works on floated elements only. * Browser support is good in Chrome, Edge, Safari; partial in Firefox.

The shape-outside property lets text flow around an arbitrary shape instead of the default rectangular box. It works only on floated elements.

Syntax Overview

.float {
  float:left;                     /* must be floated */
  width:200px; height:200px;
  shape-outside:circle(50% at 50% 50%);  /* a perfect circle */
  clip-path:circle(50% at 50% 50%);    /* optional visual cropping */
}
  • The shape can be a circle(), ellipse(), polygon(), or even an image with url() (supported in Chrome & Safari).
  • clip-path is purely visual; shape-outside tells the layout engine how to wrap text.

Example – Circular Image With Text Wrap

<img src="portrait.jpg" alt="Portrait" class="avatar" />
<p>Long paragraph that elegantly wraps around the circular portrait, creating a magazine‑style feel.</p>
.avatar {
  float:left;
  margin:0 1rem 1rem 0;
  width:150px; height:150px;
  shape-outside:circle(50% at 50% 50%);
  clip-path:circle(50% at 50% 50%);
}

Browser Support

  • Chrome, Edge, Safari: Full support.
  • Firefox: Partial support – shape-outside works, but clip-path may not.

Pro Tip – Use polygon() for Custom Shapes

.shape {
  shape-outside:polygon(0 0, 100% 0, 100% 70%, 0 100%);
}

This creates a trapezoid shape that text will flow around.

Accessibility Note

shape-outside does not affect assistive technology. The content is still read linearly, so ensure the surrounding text remains understandable.

Make it stickPractice what you've learned1 quiz · 6 practical tests · Optional activities from CSS Basics to AdvancedBrowse activities
Previous lessonAdvanced Flexbox – Wrapping & AlignmentContinue to lesson 32CSS Clip‑Path & MaskingBack to CSS Basics to Advanced curriculum