首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何对齐html行内的多个按钮?

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

Stack Overflow用户
提问于 2019-02-05 07:49:24
回答 2查看 2.5K关注 0票数 1

我正在努力将两个按钮对齐到行的中间,它就在表单中的一个表下面。

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

它现在是这样显示的

添加供应商前缀后,在IE中查找Joykal Infotech参考

我想要正确地对齐他们的中间行和按钮应该在同一轴上。“返回登录”不应在多行中。

这是我试过的。

代码语言:javascript
复制
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;
        }
代码语言:javascript
复制
<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>

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-02-05 07:58:14

希望,这可能有助于我在按钮上面使用一个包装器,并提供了display: flex;justify-content:center,还删除了给div.bluebutton的固定的widthmargin

并签出挠曲箱

更新-添加了供应商前缀

代码语言:javascript
复制
.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;
}
代码语言:javascript
复制
<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
EN

Stack Overflow用户

发布于 2019-02-05 07:52:07

您可以使用引导程序并使用类窗体内联的div,并将两个按钮放置在div中。将div放在要显示的td中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54529797

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档