中心的形式提交按钮HTML / CSS [英] center form submit buttons html / css

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

问题描述

我有麻烦围绕我的HTML形式的CSS提交按钮。

I'm having troubles centering my html form submit buttons in css.

现在,我使用

    <input value="Search" title="Search" type="submit" id="btn_s"> 
    <input value="I'm Feeling Lucky" title="I'm Feeling Lucky" name="lucky" type="submit" id="btn_i">

这个CSS

with this css

    #btn_s{
    width:100px;
    margin-left:auto;
    margin-right:auto;
}

#btn_i {
    width:125px;
    margin-left:auto;
    margin-right:auto;
}

和它没有做任何事情,我知道我可能在做一些愚蠢的错误,任何人都可以帮我吗?

and it's not doing anything, I know i'm probably doing something stupid wrong, could anyone help me out?

感谢

推荐答案

<一个href="http://jsfiddle.net/SebastianPataneMasuelli/rJxQC/">http://jsfiddle.net/SebastianPataneMasuelli/rJxQC/

我只是缠绕其上一个div并使其居中对齐。那么你不需要的按钮任何CSS居中他们。

i just wrapped a div around them and made it align center. then you don't need any css on the buttons to center them.

<div class="buttonHolder">
  <input value="Search" title="Search" type="submit" id="btn_s"> 
  <input value="I'm Feeling Lucky" title="I'm Feeling Lucky" name="lucky" type="submit" id="btn_i">
</div>

.buttonHolder{ text-align: center; }

这篇关于中心的形式提交按钮HTML / CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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