VAA*_*AAA 5 css twitter-bootstrap-3
我有以下带引导程序的 HTML 元素:
<div class="panel-footer">
<button type="button" id="btnSave" class="btn btn-default pull-right">Save</button>
</div>
Run Code Online (Sandbox Code Playgroud)
该按钮pull-right也使用类,即float:right,但我希望灰色区域实际上panel-footer div适合按钮高度。
这是样式panel-footer:
而这对于pull-right:
有什么线索吗?
更新:
我在按钮后添加:
<div class="clearfix"></div>
Run Code Online (Sandbox Code Playgroud)
并且似乎解决了问题。这可以吗?
你可以试试这个。
<div class="panel-footer text-right">
<button type="button" id="btnSave" class="btn btn-default pull-right">Save</button>
</div>
Run Code Online (Sandbox Code Playgroud)
您只需要将text-right类添加到面板页脚。
这个对我有用。
小智 1
我运行了您在 jsFiddle 中提供的代码并得到了相同的结果。即使将按钮放置在面板默认面板中,仍然得到相同的结果。
这是一个修复。
我创建了一个jsFiddle
它包括两个示例,一个使用您的代码进行覆盖,另一个使用面板 panel-default 和 panel-body 进行 css 覆盖。
希望有帮助。
.panel-footer {
height: 50px !important;
}
#sep {
margin-top: 10px;
}
.panel-body {
background: #f3f3f3 !important;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel-footer">
<button type="button" id="btnSave" class="btn btn-default pull-right">Save</button>
</div>
<div id="sep"></div>
<div class="panel panel-default">
<div class="panel-body">
<button type="button" id="btnSave" class="btn btn-default pull-right">Save</button>
</div>Run Code Online (Sandbox Code Playgroud)