Css 居中对齐输入

Css 居中对齐输入,css,input,center,Css,Input,Center,我想知道如何在我的页面上居中对齐我的输入。谢谢 <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">

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

 <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:

左边距:自动;右边距:自动

请尝试以下代码:


输入{margin left:auto;margin right:auto;}

刚刚导致文本居中对齐的:等待,使用margin left:auto;右边距:自动