元素内的内容超过一行,不让其换行,超出内容使用‘...’代替

in web技术 with 3 comments 访问: 7,612 次

CSS实现不让其换行

如果你没用前段框架封装好的样式的话:

p{width: 100px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}

强制换行(解决英文不换行问题)

p {
  width: 15%;
  table-layout: fixed;
  WORD-BREAK: break-all;
  WORD-WRAP: break-word;
}
赞赏支持
Responses
  1. is Hypter Text Mark Language. Width:100px is CSS code.

    Reply
  2. 刘伟鹏

    php的一个函数好像也可以解决

    Reply
    1. @刘伟鹏

      show me , thx

      Reply