To wrap text in CSS, use the following properties:
word-wrap
(Deprecated, useoverflow-wrap
)
Forces text to wrap onto the next line if it’s too long.overflow-wrap
(Preferred)
Similar toword-wrap
for breaking long words.white-space
Controls how whitespace and line breaks are handled:- Example:
Default Behavior:
Most block elements like <p>
wrap text automatically unless styles like white-space: nowrap;
are applied.