本文介绍了如何允许引导下拉项目列表显示在 class="well" 之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题源于这个问题.引导程序 3 按钮的动态宽度保持在 col-md-* 按钮上带有长标签

这是问题的示例.

http://codepen.io/anon/pen/ORJagG

HTML

<div class="row"><div class="col-md-1"><div class="well well-lg"><div class="btn-group"><button type="button" class="btn btn-default dropdown-toggle hideOverflow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">这是一些非常非常非常非常非常非常非常非常非常非常非常非常非常非常长的文本<span class="caret"></span><ul class="下拉菜单"><li><a href="#">一些带有很长文本的按钮</a></li><li><a href="#">一些带有很长文本的按钮</a></li><li><a href="#">一些带有很长文本的按钮</a></li><li><a href="#">一些带有很长文本的按钮</a></li>

<div class="col-md-1"><div class="well"><div class="btn-group"><button type="button" class="btn btn-default dropdown-toggle hideOverflow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">这是一些非常非常非常非常非常非常非常非常非常非常非常非常非常非常长的文本<span class="caret"></span><ul class="下拉菜单"><li><a href="#">应该像这样工作,但在井里...</a></li><li><a href="#">一些带有很长文本的按钮</a></li><li><a href="#">一些带有很长文本的按钮</a></li><li><a href="#">一些带有很长文本的按钮</a></li>

.hideOverflow{溢出:隐藏;空白:nowrap;文本溢出:省略号;宽度:100%;显示:块;}.btn-组{显示:块;}.well-lg{溢出:隐藏;}
解决方案

(添加评论作为答案,以防将来可能对某人有所帮助)

您可以调整.well 上的min-height 并删除.well-lg 上的overflow.

.well {最小高度:85px;}

这是笔:codepen.io/anon/pen/BLaGVB

This issue stems from this issue. Dynamic width of a bootstrap 3 button to stay in col-md-* with long label on button

Here is the example of the issue.

http://codepen.io/anon/pen/ORJagG

HTML

<div class="container-fluid">
<div class="row">
    <div class="col-md-1">
        <div class="well well-lg">
            <div class="btn-group">
              <button type="button" class="btn btn-default dropdown-toggle hideOverflow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
               This is some really really really really really really test really really really long text<span class="caret"></span>
               </button>
                <ul class="dropdown-menu">
                    <li><a href="#">some button with really long text</a></li>
                  <li><a href="#">some button with really long text</a></li>
                  <li><a href="#">some button with really long text</a></li>
                  <li><a href="#">some button with really long text</a></li>

                </ul>
            </div>
            </div>
        </div>
  <div class="col-md-1">
                <div class="well">
     <div class="btn-group">
              <button type="button" class="btn btn-default dropdown-toggle hideOverflow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
               This is some really really really really really really test really really really long text<span class="caret"></span>
               </button>
                <ul class="dropdown-menu">
                    <li><a href="#">Should work like this but in the well...</a></li>
                  <li><a href="#">some button with really long text</a></li>
                  <li><a href="#">some button with really long text</a></li>
                  <li><a href="#">some button with really long text</a></li>
                </ul>
        </div>
      </div>
    </div>
</div>
.hideOverflow
{
   overflow:hidden;
   white-space:nowrap;
   text-overflow:ellipsis;
   width:100%;
   display:block;
}

.btn-group{
  display:block;
}

.well-lg{
  overflow:hidden;
}
解决方案

(Adding comment as answer in case it may help someone out in the future)

You can adjust the min-height on .well and remove the overflow on .well-lg.

.well {
  min-height: 85px;
}

Here's the pen: codepen.io/anon/pen/BLaGVB

这篇关于如何允许引导下拉项目列表显示在 class="well" 之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 19:59