text-align: right; only for placeholder?

Viewed 91861


how can active text-align: right; only for placeholder?

<input type="text" name="airline_search" style="direction: ltr;  border: none;" placeholder="ارلاین">

i want use of direction: ltr; for text(that typed to inpute), and text-align: right; for placeholder.

12 Answers

As of year 2020, CSS selector ::placeholder is supported in all major browsers except Internet Explorer:

input::placeholder {
    text-align: right;
}

Edge requires vendor prefix:

input::-webkit-input-placeholder {
    text-align: right;
}

Sources: Can I use, MDN

<style>
::placeholder {/* Firefox */
text-align: right;}

:-ms-input-placeholder { /* Internet Explorer 10-11 */
 text-align: right;}
 
::-ms-input-placeholder { /* Microsoft Edge */
text-align: right;}  </style>

<input  type="text" placeholder="تست">

input placeholder align :

::-webkit-input-placeholder {
    text-align: right;
}

input text align :

<input style="text-align: left;" />
Related