html - h3 右侧的 Bootstrap 按钮

标签 html css twitter-bootstrap

在代码blow中,取决于我是否使用display:inline-block或者,加号按钮位于右上角或右下角,但绝不与 h3 位于同一行.

问题是什么?

https://jsfiddle.net/DTcHh/35253/

<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

<div style="border: 1px solid">
  <h3 style="text-align: center;display:inline-block">aaaaaaaaaaa</h3>
  <span class="glyphicon glyphicon-plus btn-flat" style="float:right;"></span>
</div>


<div style="border: 1px solid">
  <h3 style="text-align: center;">bbbbbbbbb</h3>
  <span class="glyphicon glyphicon-plus btn-flat" style="float:right;"></span>
</div>

最佳答案

你想要这样:

<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

  <div style="border: 1px solid">
  <h3 style="text-align:center; margin:0px; padding:10px 5px;">aaaaaaaaa
  <span class="glyphicon glyphicon-plus btn-flat" style="float:right; position:relative; top:8px; font-size:15px;"></span></h3>
  </div>


  <div style="border: 1px solid">
  <h3 style="text-align:center; margin:0px; padding:10px 5px;">bbbbbbbbb
  <span class="glyphicon glyphicon-plus btn-flat" style="float:right; position:relative; top:8px; font-size:15px;"></span></h3>
  </div>

关于html - h3 右侧的 Bootstrap 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45207529/

相关文章:

html - 将 div 置于另一个绝对 div 之下

javascript - 显示 data-id 到 <select> Bootstrap 模式

html - 使用 Bootstrap 的响应式设计切换

javascript - 检查 HTML5 Canvas 上的像素是否为黑色

javascript - 如何设置这个 AngularJS 网站的默认排序顺序?

html - 如何在不滚动的情况下使页眉和页脚可见?

css - 删除表格的底部边框

html - 使用 lang css 指令缩小字体大小会产生奇怪的结果

javascript - 如何在iframe head中添加div标签

javascript - HTML 屏幕分辨率