Home >Web Front-end >CSS Tutorial >Enjoy with CSS!(word-wrap)

Enjoy with CSS!(word-wrap)

Linda Hamilton
Linda HamiltonOriginal
2025-01-22 22:16:11216browse

Enjoy with CSS!(word-wrap)

Handling long words exceeding screen width in CSS can be tricky. The flex-wrap property won't suffice; instead, utilize word-wrap to elegantly wrap overflowing text onto the next line.

To achieve this, simply incorporate the following CSS:

<code class="language-css">word-wrap: break-word;
hyphens: auto;</code>

The hyphens: auto property adds hyphens at the end of lines, providing visual cues that the word continues on the next line. This enhances readability when long words are broken across lines.

The above is the detailed content of Enjoy with CSS!(word-wrap). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn