word-break:break-word未起到作用

有一部分内容是从word或execel中复制到div中 遇到了这样一个问题 在某个宽度内 英语单词不是以整个单词的形式出现的 。复制的内容如下duties or obligations; the things that you must do, because nobody else will do them 图片描述

阅读 3.9k
2 个回答

字符串里面 换成正常的空格才会正常解析单词啊,不然这就是一长串的字符串
duties or obligations; the things that you must do, because nobody else will do them

按说写在div中就会自己换行,你试试一下代码可以不

 overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题