Home >Backend Development >PHP Tutorial >Page design, Chinese and English output, automatic line wrapping_PHP tutorial

Page design, Chinese and English output, automatic line wrapping_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:54:401180browse

Today I experienced another disgusting page misalignment phenomenon. The reason is very simple. When outputting Chinese characters on the page, if the area width is not enough, it will automatically wrap. However, English letters cannot, which means that you output something like "aaaaaaaaaaaa" A string of characters, the page thinks it is a word and cannot be broken. If it is output in

, and the width of this area is only 3 characters, then the page will be misaligned. . If you change it to "aaa aaa aaa aaa", of course it's OK, because the page treats them as four words, and it can be wrapped.

If you want to force a line break, just add word-wrap:break-word;/*force a line break*/ in the CSS design

#test{

 …;

 …;

word-wrap:break-word;/*Force line break*/

}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477938.htmlTechArticleI experienced the disgusting page dislocation phenomenon again today. The reason is very simple. When outputting Chinese characters on the page, if the area width is not enough , it will wrap automatically. However, English letters cannot, that is...
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