liveBook · Manning

Shape-image-threshold

As explained in CSS in Depth, Second Edition

The CSS shape-image-threshold property sets the opacity threshold used to determine the boundary of an image-based shape.

shape-image-threshold sets the opacity level at which an image-based shape boundary is drawn. With a smooth gradient, it can move text wrapping inward to partially opaque areas. section 14.4.2

Allow overlap into a gradient

Set shape-image-threshold: 0.3 to wrap text where the gradient reaches 30% opacity, allowing text to overlap an image while it remains partially opaque. section 14.4.2

Listing 14.17 A shape defined by a gradient
.poem-image {

  float: left;
  --gradient: linear-gradient(     #1
    65deg,                         #1
    black 0 375px,                 #1
    transparent 375px);            #1
  mask: var(--gradient);
  shape-outside: var(--gradient);
  shape-margin: 15px;
}

.poem-image > img {
  display: block;
  height: 350px;
  object-position: -100px 0;      #2
}

Pairs a linear gradient with shape-outside and shape-margin to create a diagonal text-wrapping shape; adjust the threshold to change its effective edge. section 14.4.2

How CSS in Depth, Second Edition covers it

How deep it goes
Explains the 30% opacity rule with a gradient example, but does not develop broader value syntax or compatibility details.
Examples
Uses a smooth gradient and a 0.3 threshold to demonstrate text overlapping a partially opaque image.
What it assumes
Assumes familiarity with shape-outside and gradients while teaching how opacity determines a shape boundary.
What you can do after
Apply it via CSS to control the effective edge of gradient-defined text-wrapping shapes.
How it connects
Connects image-based shapes with gradients, shape-outside, shape-margin, floats, and text wrapping.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.