中心HTML输入文本字段占位符 [英] Center HTML Input Text Field Placeholder

查看:94
本文介绍了中心HTML输入文本字段占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用下面的代码,但不起作用:



CSS - >

  input.placeholder {
text-align:中央;
}
.emailField {
top:413px;
right:290px;
width:355px;
height:30px;
position:absolute;
border:none;
font-size:17;
text-align:center;
}

HTML - >

 < form action =method =POST> 
< input type =textclass =emailFieldplaceholder =support@socialpic.orgstyle =text-align:centername =email/>
<!< input type =submitvalue =submit/>
< / form>


解决方案

如果只想更改占位符样式



  ::  -  webkit-input-placeholder {
text-align:center;
}

:-moz-placeholder {/ * Firefox 18- * /
text-align:center;
}

:: - moz-placeholder {/ * Firefox 19+ * /
text-align:center;
}

:-ms-input-placeholder {
text-align:center;
}


How can I centre the input field's placeholder's alignment in a html form?

I am using the following code, but it doesn't work:

CSS ->

input.placeholder {
    text-align: center;
}
.emailField {
    top:413px;
    right:290px;
    width: 355px;
    height: 30px;
    position: absolute;
    border: none;
    font-size: 17;
    text-align: center;
}

HTML ->

<form action="" method="POST">
    <input type="text" class="emailField" placeholder="support@socialpic.org" style="text-align: center" name="email" />
    <!<input type="submit" value="submit" />  
</form>

解决方案

If you want to change only the placeholder style

::-webkit-input-placeholder {
   text-align: center;
}

:-moz-placeholder { /* Firefox 18- */
   text-align: center;  
}

::-moz-placeholder {  /* Firefox 19+ */
   text-align: center;  
}

:-ms-input-placeholder {  
   text-align: center; 
}

这篇关于中心HTML输入文本字段占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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