Nofel Nofel - 1 month ago 7
CSS Question

Placeholder text-align

I am using the following style for placeholder, but it turns the input text (when i start typing) to start from right to left. Now i am seeing this example, it is just text-align, but why mine is formatting wrong? Here is the fiddle for my example

input[placeholder="Required"]{
text-align: right;
}

Answer

Your selector input[placeholder="Required"] selects an input with a placeholder attribute, not the placeholder itself.

Use the selectors given in your example:

input::-webkit-input-placeholder {
  text-align: right;
}
input:-moz-placeholder {
  text-align: right;
}
input::-moz-placeholder {
  text-align: right;
}
input:-ms-input-placeholder {
  text-align: right;
}
<form method="post">
  <div class="blocks">
    <label for="fullname">Full Name</label>
    <input type="text" id="fullname" name="name" placeholder="Required">
  </div>
  <div class="blocks">
    <label for="Email">Email Address</label>
    <input type="Email" id="Email" name="email" placeholder="Required">
  </div>
</form>

Comments