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 ->
inpu
you can use also this way to write css for placeholder
input::placeholder{
text-align: center;
}
input{
text-align:center;
}
is all you need.
Working example in FF6. This method doesn't seem to be cross-browser compatible.
Your previous CSS was attempting to center the text of an input element which had a class of "placeholder".
You can try like this :
input[placeholder] {
text-align: center;
}
::-webkit-input-placeholder {
font-size: 14px;
color: #d0cdfa;
text-transform: uppercase;
text-transform: uppercase;
text-align: center;
font-weight: bold;
}
:-moz-placeholder {
font-size:14px;
color: #d0cdfa;
text-transform: uppercase;
text-align: center;
font-weight: bold;
}
::-moz-placeholder {
font-size: 14px;
color: #d0cdfa;
text-transform: uppercase;
text-align: center;
font-weight: bold;
}
:-ms-input-placeholder {
font-size: 14px;
color: #d0cdfa;
text-transform: uppercase;
text-align: center;
font-weight: bold;
}
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;
}
You can make like this:
<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>
Working CodePen here