Specify a number of pixels to limit the width of the text.
Font size defined by text-size
parameter will be used and text split into multiple lines to fit in the defined width. If required, it is possible to force text to not be split into multiple lines, setting text-break
parameter to false
.
If text is bigger than the specified width dimensions it will be cropped.
Values
This parameter accepts positive integer values greater than zero.
The default value for this parameter is 0
, disabling any width limit for text rendering.
Examples
In this example, we are specifying a text-width
of 500
pixels with a text-size
of 40
points. Text will be split into multiple lines to accommodate the text to a maximum width of 500 pixels:
GET
https://assets.imglab-cdn.net/particles.jpeg?text-width=500&text-size=40
Reducing text-width
to a smaller number of 300
pixels with a text-size
of 40
points:
GET
https://assets.imglab-cdn.net/particles.jpeg?text-width=300&text-size=40
Reducing text-width
even more to 120
pixels with a text-size
of 40
points
GET
https://assets.imglab-cdn.net/particles.jpeg?text-width=120&text-size=40
Notice that if the text is bigger than the limit defined by text-width
it will be cropped. To avoid this you can use text-width
and text-height
together.