巴顿中心CSS [英] Button Center CSS

查看:115
本文介绍了巴顿中心CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

常住CSS定心问题,只是不工作对我来说,问题是我不知道最终的宽度像素

我对整个资产净值的div然后内每个按钮,他们不中心不再当存在多于一个的按钮。 (

CSS

  .nav {
    的margin-top:167px;
    宽度:1,024;
    高度:34像素;
}.nav_button {
    高度:34像素;
    保证金:0汽车;
    保证金权:10px的;
    浮动:左;
}

HTML

 < D​​IV CLASS =导航>
        < D​​IV CLASS =nav_button>
            < D​​IV CLASS =b_left>< / DIV>
            < D​​IV CLASS =b_middle>家庭和LT; / DIV>
            < D​​IV CLASS =b_right>< / DIV>        < / DIV>
        < D​​IV CLASS =nav_button>
            < D​​IV CLASS =b_left>< / DIV>
            < D​​IV CLASS =b_middle>联系我们< / DIV>
            < D​​IV CLASS =b_right>< / DIV>        < / DIV>
< / DIV>

任何帮助将大大AP preciated。谢谢


结果

如果宽度是未知的,我没有找到一个办法中心的按钮,而不是完全满意,但并不重要,它的工作原理:D

最好的办法是把它放在一个表格

 <表类=导航ALIGN =中心>
    &所述; TR>
      &所述; TD>
        < D​​IV CLASS =nav_button>
            < D​​IV CLASS =b_left>< / DIV>
            < D​​IV CLASS =b_middle>家庭和LT; / DIV>
            < D​​IV CLASS =b_right>< / DIV>
        < / DIV>        < D​​IV CLASS =nav_button>
            < D​​IV CLASS =b_left>< / DIV>
            < D​​IV CLASS =b_middle>联系我们< / DIV>
            < D​​IV CLASS =b_right>< / DIV>
        < / DIV>
      < / TD>
    < / TR>
  < /表>


解决方案

我意识到这是一个非常古老的问题,但我今天过这个问题绊了一跤,我得到了它与

工作

 < D​​IV的风格=文本对齐:中心;>
    <按钮和GT; Button1的< /按钮>
    <按钮和GT;&按钮2 LT; /按钮>
< / DIV>

干杯,
马克

Usual CSS centering issue, just not working for me, the problem is that I don't know the finished width px

I have a div for the entire nav and then each button inside, they dont center anymore when there is more than one button. :(

CSS

.nav{
    margin-top:167px;
    width:1024px;
    height:34px;
}

.nav_button{
    height:34px;
    margin:0 auto;
    margin-right:10px;
    float:left;
}

HTML

<div class="nav">
        <div class="nav_button">
            <div class="b_left"></div>
            <div class="b_middle">Home</div>
            <div class="b_right"></div>

        </div>
        <div class="nav_button">
            <div class="b_left"></div>
            <div class="b_middle">Contact Us</div>
            <div class="b_right"></div>

        </div>
</div>

Any help would be greatly appreciated. Thanks


Result

If the width is unknown, I did find a way a center the buttons, not entirely happy but doesnt matter, it works :D

The best way is to put it in a table

<table class="nav" align="center">
    <tr>
      <td>
        <div class="nav_button">
            <div class="b_left"></div>
            <div class="b_middle">Home</div>
            <div class="b_right"></div>
        </div>

        <div class="nav_button">
            <div class="b_left"></div>
            <div class="b_middle">Contact Us</div>
            <div class="b_right"></div>
        </div>
      </td>
    </tr>
  </table>

解决方案

I realize this is a very old question, but I stumbled across this problem today and I got it to work with

<div style="text-align:center;">
    <button>button1</button>
    <button>button2</button>
</div>

Cheers, Mark

这篇关于巴顿中心CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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