如何在html表单中居中输入字段的占位符对齐方式?
我正在使用以下代码,但它不起作用:
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;
}
超文本标记语言->
<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>
发布于 2013-03-13 14:06:30
如果只想更改占位符样式
::-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;
}
发布于 2011-09-12 05:44:51
input{
text-align:center;
}
就是你所需要的。
FF6中的Working example。这个方法似乎不是跨浏览器兼容的。
您之前的CSS试图居中输入元素的文本,该元素的类为"placeholder“。
发布于 2016-03-19 03:33:12
你可以这样做:
<center>
<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>
</center>
https://stackoverflow.com/questions/7381446
复制相似问题