如何对齐井内的元素?

时间:2016-04-23 02:24:31

标签: jquery html css twitter-bootstrap dreamweaver

我正在尝试将按钮与井中的某些文本对齐。

这是我能得到的最好的:

btn {
background-color: #FFF;
outline-color: #000;
}

按钮上的CSS:

function love.draw()
   love.graphics.point( 20, 20 )
end

上面我似乎无法在h4和btn之间找到一个空间...它们是如此紧密,填充和放大保证金似乎没有帮助。

之前我尝试将h4和btn分别插入col-md-8和col-md-6,以获得自己的空间,但我无法让它水平对齐。

然后我在github https://github.com/twbs/bootstrap/issues/16933上阅读这些帖子.... https://github.com/twbs/bootstrap/issues/1446 ...听起来这个问题已经存在了一段时间?

我正在使用一口井,因为我想保持h4和btn接近并且在红色区域吸引注意力。

任何帮助?

2 个答案:

答案 0 :(得分:0)

编织: http://kodeweave.sourceforge.net/editor/#6e1a68050ce5981e47e0512857f2dd73

您可以使用media queries

<强> CSS:

.btn {
  background-color: #FFF;
  outline-color: #000;
  display: inline-block;
  float: right;
  margin: -9px 0;
}
.well {
  text-align: left;
}

@media all and (max-width: 575px) {
  .well {
    text-align: center;
  }
  .btn {
    display: block;
    clear: both;
    float: none;
    text-align: center;
    margin: 20.92px auto;
  }
}

答案 1 :(得分:0)

通常使用<table><table/>来使文字对齐。将按钮和文本放在一个包含1行和2个字符的表中

<table>
    <tr>
        <td>
            TEXT
        <td/>
        <td>
            BUTTON
        <td/>
    </tr>
<table/>

如果你环顾网站(甚至是这个网站),你会发现这个页面是一个带有按钮,文本框,瓷砖嵌入的大桌子