CSS Shapes and Exclusions
Learn how CSS Shapes changes inline wrapping geometry around floats, how shape-outside, shape-margin, and image-derived shapes work, and where CSS Exclusions, text layout, images, overflow, and clipping stop owning the problem.
Intermediate
CSS Shapes changes the geometry available to nearby inline content without changing the document order. The core stable authoring model is shape-outside, which lets a box expose a non-rectangular float shape so inline content can wrap around that shape instead of the float box rectangle.
This lesson is the primary Foxipa owner for CSS Shapes and the practical boundary of CSS Exclusions: shape geometry used for text wrapping, shape-outside, shape-margin, shape-image-threshold, the shape functions and image-derived shapes they accept, and the distinction between a shape that influences wrapping and a shape used only for painting or clipping.
The central model
A CSS shape is a geometric boundary used to determine where inline content may flow. It is not a new box, does not replace the float, and does not rewrite the document structure.
Output
Ready to run.
Quick check
What does a CSS shape primarily change?
Shapes do not replace floats
The stable CSS Shapes Level 1 model is built around floated boxes. The float still participates in the flow according to Flow Layout; shape-outside changes the region that inline content must avoid around that float.
Output
Ready to run.
Quick check
Which mechanism remains responsible for making the element a float?
The shape reference box
Shape geometry is resolved against a reference box associated with the float. The shape can therefore describe a boundary that is different from the simple rectangular area suggested by the element’s outer box.
Do not confuse the shape reference geometry with border painting, clipping, or the visual pixels of an image. A wrapping shape is a layout input; a clipping path is a painting/visibility operation owned elsewhere.
Output
Ready to run.
Quick check
Is a wrapping shape the same thing as a clipping path?
Basic shape functions
CSS Shapes accepts basic shape functions such as circle(), ellipse(), inset(), polygon(), and related geometry defined by the CSS Shapes value model. The function describes a boundary; the browser uses that boundary when determining the available inline region around the float.
Output
Ready to run.
Quick check
What does polygon() describe?
Output
Ready to run.
Quick check
Does inset() create a new element?
Newer shape functions in the current draft
The current CSS Shapes Level 1 Editor's Draft expands the basic-shape value model with functions including path(), rect(), xywh(), and shape(). These are useful when a wrapping boundary needs more precise or programmable geometry than the older circle(), ellipse(), inset(), and polygon() forms. They are current draft material, so Foxipa treats them as developing rather than implying universal stable support.
Output
Ready to run.
Quick check
Why is shape() marked as developing material in this lesson?
The shape-outside property
shape-outside establishes the shape used for wrapping inline content around a float. Its value may describe a basic shape, use a reference box, or derive geometry from an image depending on the supported value form.
Output
Ready to run.
Quick check
Which property chooses the wrapping shape?
Shape margin
shape-margin expands the effective wrapping region outward from the shape. It creates breathing room between the shape boundary and nearby inline content without changing the float’s own box dimensions.
Output
Ready to run.
Quick check
What does shape-margin do?
This distinction matters: ordinary margin belongs to the box model and changes spacing around the float box. shape-margin changes the wrapping boundary generated from the shape.
Output
Ready to run.
Quick check
Which margin belongs to the CSS Shapes wrapping boundary?
Image-derived shapes
CSS Shapes can derive a wrapping shape from an image. This is useful when the visible subject of an image is not rectangular. The image itself remains an image-value concern owned by Images/Gradients/Replaced Content; Shapes owns how alpha-derived geometry can influence wrapping.
Output
Ready to run.
Quick check
Which area remains owned by the Images lesson?
shape-image-threshold
shape-image-threshold controls which image alpha values contribute when an image is used to define a shape. A threshold changes the boundary extracted from the image; it does not recolor or clip the image itself.
Output
Ready to run.
Quick check
What does shape-image-threshold control?
Shape geometry is not painting
A shape may resemble a visible outline, but CSS does not paint the shape boundary merely because shape-outside is set. The property supplies geometry to wrapping. If you need visible clipping, use the separate clipping/masking model, which is covered by the Masking, Clipping, Compositing, and Blending owner.
Output
Ready to run.
Quick check
Does shape-outside paint its boundary?
Shapes and text layout
Once a shape establishes the available inline region, Text Layout still determines whitespace processing, line breaking, justification, and other text behavior. Shapes does not become a second text-formatting engine.
Output
Ready to run.
Quick check
When a shape makes a line narrower, who still decides where text breaks?
Shapes and writing modes
Shape coordinates and the meaning of block/inline directions interact with the writing mode of the containing context. Writing Modes owns the definition of those axes; this lesson uses that model rather than redefining physical and logical directions.
Output
Ready to run.
Quick check
Who owns the meaning of block and inline axes?
Shapes and overflow
A wrapping shape does not make overflow disappear. Overflow Layout owns clipping and scrollable overflow. If content extends outside a box, do not use shape-outside as an overflow-control mechanism.
Output
Ready to run.
Quick check
Can shape-outside replace overflow:hidden?
Multiple floats and overlapping shapes
More than one float can contribute wrapping constraints. Each float has its own box and shape; the available inline region is determined by the combined layout constraints rather than by a single global shape.
Output
Ready to run.
Quick check
Can a page have more than one active shape?
Shape margins and box margins are independent
When debugging a shape, inspect the float’s box margin and shape-margin separately. A surprising gap can come from either source, and changing one does not conceptually change the other.
Output
Ready to run.
Quick check
If changing margin moves the box but changing shape-margin changes the wrap boundary, what does that reveal?
The shape must be useful for wrapping
A shape is only useful when the surrounding inline content has an opportunity to wrap around the float. If the layout context does not produce the relevant float/inline interaction, changing shape-outside may appear to do nothing. That is a layout-context issue, not evidence that the shape value is invalid.
Output
Ready to run.
Quick check
If shape-outside seems to have no effect, what should you inspect first?
The Exclusions boundary
CSS Exclusions was designed to generalize the idea of an exclusion area so content could wrap around shaped boxes beyond the traditional float model. The W3C CSS Working Group publication describes properties for assigning shapes and controlling how text in other boxes wraps around them, including absolutely positioned exclusions.
Quick check
Why is Exclusions not taught as a second full float-like layout system here?
Shapes versus masking and clipping
A shape answers “where may inline content flow?” Masking or clipping answers “which painted pixels remain visible?” The geometries can sometimes look alike, but the questions are different and belong to different stages of CSS processing.
Output
Ready to run.
Quick check
Which question belongs to CSS Shapes?
Developing and deferred shape features
CSS Shapes Level 1 is the stable curriculum foundation. Newer Shapes/Exclusions work should be treated according to its current specification status and implementation maturity rather than presented as if every draft feature were a universal CSS feature.
The property index currently identifies shape-outside, shape-margin, and shape-image-threshold with CSS Shapes Level 1, while shape-inside appears in a different historical/draft context. This curriculum therefore does not promote shape-inside into the same stable lesson core.
Quick check
How should draft-only or historical shape features be presented?
Debugging shapes systematically
Start with the float: confirm that it is actually floating and that inline content can wrap beside it. Then inspect shape-outside, the shape reference box, shape-margin, and any image threshold. Finally inspect Flow, Text, Writing Modes, and Overflow rather than assuming every mismatch is a shape bug.
Output
Ready to run.
Quick check
What is the most useful first debugging question?
A decision tree for ownership
If you need a non-rectangular region for inline text to wrap around a float, start with CSS Shapes. If you need float participation, inspect Flow Layout. If you need text processing or line breaking, inspect Text Layout. If you need image-value or intrinsic-size behavior, inspect Images. If you need clipping or compositing of painted output, use the Masking/Clipping/Compositing/Blending owner. If you are considering historical Exclusions properties, treat them as a specification-status question rather than a second stable curriculum path.
Quick check
Which owner should you consult for a non-rectangular float wrapping boundary?
Final ownership summary
CSS Shapes owns the geometry that changes how inline content wraps around floated boxes. It does not own float creation, line breaking, image sizing, overflow clipping, painting, or imperative APIs. Keeping those boundaries explicit prevents the curriculum from repeating the same concept under different property names.
Quick comparison: what changes what?
Output
Ready to run.
Quick check
Which change should you make when you want more distance from the shape but not a larger float box?
Quick check
Which property would be the wrong tool for making text wrap around a float?
Quick check
Which statement is correct?
Thanks for your feedback.
Mark this learning resource complete to track your learning progress.