如何对齐井内的元素? [英] How to align elements within a well?

查看:106
本文介绍了如何对齐井内的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我能得到的最好的结果:

 < div class =container> 
< div class =row>
< div class =col-lg-12>
< div class =well>< h4>立即下载我们的2016注册表!< button type =btnclass =btn btn-default centered>按钮>< / H4>
< / div>
< / div>
< / div>
< / div>

按钮上的CSS:

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

有了上述我似乎无法在h4和btn ...他们很紧密,填充&am​​p;保证金似乎没有帮助。

以前,我尝试将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的紧密关系,并在红色的领域吸引注意力。



有什么帮助?

解决方案

使用< table>< table /> 让你的文字对齐。将按钮和文本放在1行2列的表中

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

如果你在网站中浏览(即使是这个网站),你会看到该页面是一张大桌子与按钮,文本框,图块中的img


I'm trying to align a button with some text in a well.

This is the best I can get:

<div class="container">
    <div class="row">
        <div class="col-lg-12">
             <div class="well"><h4>Download our 2016 Registration form today!<button type="btn" class="btn btn-default centered">Download Now!</button></h4>
             </div>
         </div>
     </div>
 </div>

CSS on the button:

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

With the above I can't seem to get a space between the h4 and the btn... They're so tight together, padding & margin do not seem to help.

Previously I tried inserting the h4 and btn into col-md-8 and col-md-6 respectively, to have their own space, but I could not get it to align horizontally.

Then I read these posts on github https://github.com/twbs/bootstrap/issues/16933 .... https://github.com/twbs/bootstrap/issues/1446 ... Sounds like this issue has been around a while?

I'm using a well as I want to keep the h4 and btn close and in a field of red to attract attention.

Any help?

解决方案

It is common to use a <table><table/> to make your text aligned. put the button and the text in a table with 1 row and 2 columes

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

if you look around in websites (even this one) you will see that the page is one big table with buttons, textboxes, imgs in the tiles

这篇关于如何对齐井内的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆