如何对齐HTML行内的多个按钮?

问题描述 投票:1回答:2

我的工作比对两个按钮,这仅仅是在形式的表格下方的排的中间。

但按钮的排列,现在是垂直的。如何使他们的水平和中间。

This is how it is being displayed now

For Joykal Infotech reference in IE after adding vendor prefixes

我想正确对准他们行的中间,按键应在同一轴线上。返回登录不应该出现在多行。

下面是我试过了。

div.blueButton { /* Blue Button sized for submit */
            position:relative;
            margin:0;
            background:transparent url('../images/btn_blue_back.gif') repeat-x;
            color:white;
            padding:0 4px 6px 4px;
            text-align:center;
            width:45px;
            margin-left:520px;
        }
        div.blueButton_left {
            background:transparent url('../images/btn_blue_l.gif') no-repeat left;
            width:7px; height:22px;
            position:absolute;
            top:-2px; left:-2px;    
        }
        div.blueButton_right {
            background:transparent url('../images/btn_blue_r.gif') no-repeat right;
            width:7px; height:22px;
            position:absolute;
            top:-2px; right:-3px;   
        }

a.button, .button {
            width:auto;
            padding:0; margin:0 0 0 0;
            background:#005499;
            font-size:11px; font-weight:bold; color:white; text-decoration:none;
            cursor:pointer;
        }
<div>
<div class="blueButton">
<div class="blueButton_left"></div>
<div class="blueButton_right"></div>
<a href="" onclick="javascript:forgotUsername();return false;" class="button" onblur="javascript:f_setfocus();">Return to LogIn</a>
</div>
<div class="blueButton">
<div class="blueButton_left"></div>
<div class="blueButton_right"></div>
<a href="" onclick="javascript:forgotUsername();return false;" class="button" onblur="javascript:f_setfocus();">Continue</a>
</div>
</div>
html css html5 button tags
2个回答
0
投票

希望,这可能帮助我用的包装上面这两个按钮,并提供display: flex;justify-content:center和也去掉了固定widthmargindiv.bluebutton

而做结帐flexbox

更新 - 供应商前缀加

.wrap {
  -webkit-display: flex;
  -ms-display: flex;
  -o-display: flex;
  display: flex;
  -webkit-justify-content: center;
  -ms-justify-content: center;
  -o-justify-content: center;
  justify-content: center;
}
div.blueButton {
  /* Blue Button sized for submit */
  position: relative;
  margin: 0;
  background: transparent url('../images/btn_blue_back.gif') repeat-x;
  color: white;
  padding: 0 4px 6px 4px;
  text-align: center;
}

div.blueButton_left {
  background: transparent url('../images/btn_blue_l.gif') no-repeat left;
  width: 7px;
  height: 22px;
  position: absolute;
  top: -2px;
  left: -2px;
}

div.blueButton_right {
  background: transparent url('../images/btn_blue_r.gif') no-repeat right;
  width: 7px;
  height: 22px;
  position: absolute;
  top: -2px;
  right: -3px;
}

a.button,
.button {
  width: auto;
  padding: 0;
  margin: 0 0 0 0;
  background: #005499;
  font-size: 11px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  cursor: pointer;
}
<div class="wrap">
  <div class="blueButton">
    <div class="blueButton_left"></div>
    <div class="blueButton_right"></div>
    <a href="" onclick="javascript:forgotUsername();return false;" class="button" onblur="javascript:f_setfocus();">Return to LogIn</a>
  </div>
  <div class="blueButton">
    <div class="blueButton_left"></div>
    <div class="blueButton_right"></div>
    <a href="" onclick="javascript:forgotUsername();return false;" class="button" onblur="javascript:f_setfocus();">Continue</a>
  </div>
</div>

0
投票

您可以使用引导,并采取带班的形式,内嵌一个div,里面放上DIV两个按钮。把DIV在要显示TD。

© www.soinside.com 2019 - 2024. All rights reserved.