twitter-bootstrap 如何使文本自动转到引导列中的下一行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39294324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:16:02  来源:igfitidea点击:

how to make text automatically go to the next line in bootstrap column

htmltwitter-bootstrapcss

提问by Otachan

I have this row and column inside container

我在容器内有这一行和这一列

<div class="container">
    <div class="row">
        <div class="col-md-4" >
            <h1>About</h1>
<p>asdasdsadasdasdassdasdasdadassssssssssssssssssssssssssssssssssssssssssss</p>
        </div>  
    </div>
</div>

How can i make it go to the next line when it reach the end of the column? Layout

当它到达列的末尾时,如何使它转到下一行? 布局

回答by Mohammad Usman

Use word-wrap: break-word

利用 word-wrap: break-word

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');

.break-text p {
  word-wrap: break-word;
}
<div class="container break-text">
  <div class="row">
    <div class="col-xs-4">
      <h1>About</h1>
      <p>asdasdsadasdasdassdasdasdadassssssssssssssssssssssssssssssssssssssssssss</p>
    </div>  
  </div>
</div>

回答by TFFX

Just add to your CSS

只需添加到您的 CSS

.word-wrap{word-wrap: break-word;}

Then to your paragraph add the class

然后在你的段落中添加类

 <p class="word-wrap">asdasdsadasdasdassdasdasdadassssssssssssssssssssssssssssssssssssssssssss</p>

Another option is to apply it to the whole site or all paragraphs, for example:

另一种选择是将其应用于整个站点或所有段落,例如:

body {word-wrap: break-word;}
OR
p{word-wrap: break-word;}

回答by wi7sonjoseph

Add style to table cell

为表格单元格添加样式

td
 { 
    white-space: initial;
 }