我有一个Bootstrap面板,其右侧有标题文本和操作按钮。我一直希望按钮位于面板标题的右上角。
当文本长于一行时,它会环绕并移动按钮。我该如何预防?
https://jsfiddle.net/PHPMickB/gsc9zt8k/
我看到了类似的问题,但这没用:
Not to make bootstrap panel header components wrap
<div class="container-fluid">
<div class="row">
<div class="col-xs-8 col-lg-offset-2">
<h1>Title</h1>
<div class="panel-group">
<div class="panel panel-warning">
<div class="panel-heading skinny">
<h4 class="panel-title pull-left">
<span data-toggle="collapse" href="#collapse45">Tenetur tenetur temporibus tempora ipsam. Tenetur tenetur temporibus tempora ipsam.Tenetur tenetur temporibus tempora ipsam.
</span>
</h4>
<div class="input-group">
<div class="input-group-btn text-right">
<button onclick="btnSnoozeClick('1onDgk')" class="btn btn-warning"><i
class="glyphicon glyphicon-time"></i></button>
<button onclick="btnCompleteClick('1onDgk')" class="btn btn-warning"><i
class="glyphicon glyphicon-ok"></i></button>
<button onclick="btnDeleteClick('1onDgk')" class="btn btn-warning"><i
class="glyphicon glyphicon-trash"></i></button>
</div>
</div>
</div>
<div id="collapse45" class="panel-collapse collapse">
<div class="panel-body">
Sed vel natus ut voluptas et.
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading skinny">
<h4 class="panel-title pull-left">
<span data-toggle="collapse" href="#collapse45">Tenetur tenetur te
</span>
</h4>
<div class="input-group">
<div class="input-group-btn text-right">
<button onclick="btnSnoozeClick('1onDgk')" class="btn btn-success"><i
class="glyphicon glyphicon-time"></i></button>
<button onclick="btnCompleteClick('1onDgk')" class="btn btn-success"><i
class="glyphicon glyphicon-ok"></i></button>
<button onclick="btnDeleteClick('1onDgk')" class="btn btn-success"><i
class="glyphicon glyphicon-trash"></i></button>
</div>
</div>
</div>
<div id="collapse45" class="panel-collapse collapse">
<div class="panel-body">
Sed vel natus ut voluptas et.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
谢谢
密克
答案 0 :(得分:0)
对标题应用最大宽度。如果按钮始终是固定的大小和数字,请计算工作量。请注意,我还将行类添加到面板标题元素中,以清除浮点数(使元素随文本一起增长)。更好的解决方案是简单地添加一个清晰的类,而不是添加行并删除边距,但是这种方式可以很好地工作。
.panel-title {
max-width:calc(100% - 120px);
}