In html, you can use the word-wrap, word-break and overflow attributes to set the text beyond the line break. Just add "word-wrap:break-word;word-break:break-all;overflow:" to the text element. hidden;" style.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
I encountered a problem today, as shown in the picture:
This causes the effect to look very unsightly. Our ideal state should be to let If the content inside the div exceeds the width of the div, the content should be wrapped and displayed.
Solution:
First we have to make sure that the div has a width, and then add the css style: the code is as follows:
word-wrap:break-word; word-break:break-all; overflow: hidden;
Result As follows:
This will achieve the effect we want.
Recommended tutorial: "html video tutorial"
The above is the detailed content of How to set text beyond line break in html. For more information, please follow other related articles on the PHP Chinese website!