Reputation: 861
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;
}
Upvotes: 0
Views: 3769
Reputation: 16936
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::-ms-input-placeholder {
text-align: right;
}
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>
Upvotes: 6
Reputation: 195982
Because in the example it styles the placeholder and not the input element (like you do).
input[placeholder="Required"]::-moz-placeholder{ text-align: right; }
input[placeholder="Required"]::-ms-input-placeholder{ text-align: right; }
input[placeholder="Required"]::-webkit-input-placeholder{ text-align: right; }
Updated demo: https://jsfiddle.net/z1zuo69q/2/
Upvotes: 1