2015-09-05 102 views
0

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

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

回答

0

你想中心对齐你的输入形式,是否正确?这很容易。如果你想在<body>标签或<div>标签居中什么,或者要居中输入表单本身,你只需添加以下的CSS:

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

试着像一些代码:

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

+0

这只是导致文本被中心对齐:( –

+0

等待等待,使用'margin-left:auto; margin-right:auto' –