【问题标题】:Center Aligning an input [duplicate]中心对齐输入[重复]
【发布时间】:2015-12-01 18:36:29
【问题描述】:

我想知道如何在我的页面上居中对齐我的输入。谢谢

 <body>

 <input id="ask" type="text" placeholder = "Ex: how tall is the Gateway Arch" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Ex: how tall is the gateway arch'"/>

<style type="text/css">
    #ask {

        padding: 10px  10px 10px 6px;
        font-size:45px;
        background-color:#FAFAFA;
        min-width: 500px;
        padding: 0 auto;
        border: 0 none;
        </style>
        </body>

【问题讨论】:

    标签: css input center


    【解决方案1】:

    您想居中对齐您的输入表单,对吗?这很容易。如果您想将&lt;body&gt;&lt;div&gt; 标记中的任何内容居中,或者您想将输入表单本身居中,您只需添加以下css:

    margin-left:auto;margin-right:auto;

    尝试一些代码,例如:

    input {margin-left:auto;margin-right:auto;}

    【讨论】:

    • 这只是导致文本居中对齐:(
    • 等等等等,使用margin-left:auto;margin-right:auto
    猜你喜欢
    • 2013-11-21
    • 1970-01-01
    • 2012-09-21
    • 2013-09-01
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-04
    相关资源
    最近更新 更多