如何在 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;
}
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>
原文由 max_ 发布,翻译遵循 CC BY-SA 4.0 许可协议
如果您只想更改占位符样式,请选择
::placeholder
伪元素