CSS shape-image-threshold Property
Sets the alpha threshold for extracting a shape from an image used with shape-outside
Syntax
shape-image-threshold: <number>;Values
| Value | Description |
|---|---|
| 0 | Fully transparent pixels form the shape (default) |
| 0.5 | 50% alpha threshold |
| 1 | Only fully opaque pixels |
Example
.image-wrap {
float: left;
shape-outside: url("/shape.png");
shape-image-threshold: 0.5;
}Understanding CSS shape-image-threshold
The CSS shape-image-threshold property sets the alpha threshold for extracting a shape from an image used with shape-outside. As part of the Misc module in CSS, it is one of the most commonly used properties for controlling the visual presentation of web pages.
You can set shape-image-threshold to values such as 0, 0.5, 1, among others. Each value changes how the browser renders the affected element, giving you fine-grained control over your page layout and design. Choosing the right value depends on the specific design requirements of your project.
Common use cases for the shape-image-threshold property include responsive web design, component-based layouts, and creating visually consistent interfaces across devices. It works closely with related properties like shape-outside, shape-margin, float to achieve complex styling effects. Understanding how these properties interact helps you write cleaner, more maintainable stylesheets.
Browser support for shape-image-threshold is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. For older browsers, consider using fallback values or progressive enhancement strategies. The property can also be set dynamically via JavaScript using element.style.shapeImageThreshold or the CSS custom properties (variables) approach for theming.
Related Properties
Explore More CSS Properties
Browse our complete reference of 251 CSS properties with syntax, examples, and tips.