Article From:

First, word wrap.

  Today, when I do div internal text distribution, I found that no matter how wide the div set, there will be div inside the word out, not inside the div situation, so I used the CSS style settings, forcing the text to change lines:

  Three ways

    1、 word-break: break-all; Only for English, letters as the basis for line change.
    2、word-wrap: break-word; It only works for English, with words as the basis for line change.
    3、white-space: pre-wrap; It only works for Chinese, forcing a new line.


2. Prohibiting Line Change and Exceeding Partial Ellipsis

  * When the display ellipsis is exceeded,Make sure to add a max-width or width to the layered label of style settings, If the width of the upper tag is set, the width of the upper tag can be set to a percentage.

overflow:hidden;//Content overflow processingWhite-space: nowrap; // No line change when text exceedsText-overflow: ellipsis; //text overflow processing

Leave a Reply

Your email address will not be published. Required fields are marked *