简体   繁体   English

自动换行不在bootstrap 3中工作

[英]Word-wrap not working in bootstrap 3

I am trying to create a button having some text over it. 我正在尝试创建一个按钮,上面有一些文字。 But the text is not wrapping on the button. 但是文本没有包裹在按钮上。 Here is what i have done. 这就是我所做的。

<div class="form-group">
  <div class="col-md-6 col-sm-6 col-xs-6">
    <input type="radio" id="1" class="hidden">
    <label for="1" class="btn btn-info btn-preference  pull-right">Stability</label> 
  </div>
  <div class="col-md-6 col-sm-6 col-xs-6">
    <input type="radio" id="1" class="hidden">
    <label for="1" class="btn btn-primary btn-preference text-center">
      <span class="break-wo">Freedom and Risk</span>                                                        
    </label> 
  </div>
</div>

Here is the Link for bootfly 这是bootfly链接

It's not the wrap, it's white-space: nowrap; 它不是包裹,它是white-space: nowrap; which is preventing the text to wrap when used .btn which contains white-space: nowrap; 当使用包含white-space: nowrap; .btn时,阻止文本换行white-space: nowrap; so use white-space: normal; 所以使用white-space: normal;

label[for="1"].btn {
    white-space: normal;
}

Demo 演示


Note: Your ID value is invalid, you cannot start an id with a number 注意:您的ID值无效,您无法使用数字启动id

Have you tried adding white-space: normal; 你有没有试过添加white-space: normal; to your span class="break-wo" ? 你的span class="break-wo" This should help. 这应该有所帮助。

Try this way... 试试这种方式......

<div class="radio">
 <label class="btn btn-info">
  <input type="radio" id="1" name="optionsRadios" class="hidden" value="option1" checked>
  Option one
 </label>
</div>

Adding the tag inside the label 在标签内添加标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM