Bootstrap下拉菜单:如何使文本很好地包装 [英] Bootstrap dropdown: how to make text wrap nicely

查看:108
本文介绍了Bootstrap下拉菜单:如何使文本很好地包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Bootstrap。我想要一个带有下拉列表的按钮,如下所示:

 < div class =btn-group> 
< a class =btn dropdown-toggle btn-minidata-toggle =dropdownhref =#>
动作
< span class =caret>< / span>
< / a>
< div class =dropdown-menustyle =width:300px;>
< div>

长文字到这里。

< / div>
< / div>
< / div>

而不是下拉菜单,我有< div> 与长文本和其他html标签。问题是我尝试了不同的CSS规则,并且长文本超出< div> 或导致滚动条显示。我只是希望长文本在< div> 中很好地包装,取决于文本的数量。



<我如何做到这一点?



我使用下拉菜单组件错误的方式?

解决方案

只需将 white-space:normal; 添加到 .dropdown-menu



示例小提琴


I am learning Bootstrap. I would like to have a button with dropdown such as the following:

<div class="btn-group">
  <a class="btn dropdown-toggle btn-mini" data-toggle="dropdown" href="#">
    Action
    <span class="caret"></span>
  </a>
  <div class="dropdown-menu" style="width: 300px;">
    <div >

  Long text goes here.

    </div>
  </div>
</div>

Instead of dropdown menu, I have <div> with long text and other html tags. The problem is that I tried different CSS rules and the long text either extends beyond the <div> or causes scroll bars to show up. I just want the long text wrap nicely within the <div> and goes down depending on the amount of text.

How can I do this?

Am I using "dropdown-menu" component the wrong way?

解决方案

Just add white-space: normal; to your .dropdown-menu

Example fiddle

这篇关于Bootstrap下拉菜单:如何使文本很好地包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆