此问题源于此问题。 Dynamic width of a bootstrap 3 button to stay in col-md-* with long label on button
这是问题的例子。
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;
}
最佳答案
(添加评论作为答案,以防将来对某人有所帮助)
您可以调整min-height
上的.well
并删除overflow
上的.well-lg
。
.well {
min-height: 85px;
}
这是笔:codepen.io/anon/pen/BLaGVB