An interesting way to generate your path is to use an image with an alpha channel — the text will then wrap around the non-transparent parts of the image. This allows the overlay of wrapped content around an image, or the use of an image which is never displayed on the page purely as a method of creating a complex shape without needing to carefully map a polygon.
Note that images used in this way must be CORS compatible, otherwise shape-outside
will act as if none
had been given as the value, and you will get no shape.
In this next example, we have an image with a fully transparent area, and we are using an image as the URL value for shape-outside
. The shape is created around the opaque area — the image of the balloon.
shape-image-threshold
The shape-image-threshold
property is used to set the threshold of image transparency used to define the area of the image used for the shape. If the value of shape-image-threshold
is 0.0
(which is the initial value) then the area must be fully transparent. If the value is 1.0
then it is fully opaque. Values in between mean that you can set a semi-transparent area as the defining area of the shape.
You can see the threshold in action if we use a gradient as the image on which to define our shape. In the example below, if you change the threshold the path that the shape takes changes based on the level of opacity you have selected.
We take a deeper look at creating shapes from images in the Shapes from Images guide.