CSS - 不中断单词的换行符



我正在使用内容管理,但换行符产生了问题。我正在显示一些内容,它不会自动在多行中中断。所以我使用了CSS属性"word-wrap:break-word"。

当我使用它时,线路被刹车,但它会切断行尾的单词。

我只想打破一行,不想打破一个字。

有什么解决方案吗?

.HTML

<div class="profile_fields">
 <ul>
  <li>
    <span id="CE_profile">Description:</span>
    <span>Join us in this 90 minute presentation and learn the indications and 
          "how to" for practical topics that will improve your diagnostic and
           treatment skills with cats. 
    </span> 
  </li>
 </ul>
</div>

.CSS

.profile_fields {
    margin-top: 10px;
    overflow: hidden;
}
.profile_fields > ul {
    padding: 10px;
}
.profile_fields > ul > li > span + span {
    width: 330px !important;
    word-wrap: break-word;
}
.profile_fields > ul > li > span + span {
    display: block;
    float: none;
    min-width: 0;
    overflow: hidden;
    width: 380px;
}

我想在多行中打破第二个跨度的内容

小提琴:http://jsfiddle.net/fpTwP/

试试这个:

   word-break: keep-all;

有关 CSS 中断字的更多信息,请参阅此处:http://docs.webplatform.org/wiki/css/properties/word-break

最新更新