Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML change placeholder direction

Tags:

html

css

how to in styled input tag placeholder extends that parent style and i want to have right direction in left styled input.

for example this is my input:

<input type="password" style='direction:ltr;text-align:left;' id="password" placeholder="password">

placeholder text-align is left now. how to use direction:rtl for that?

like image 677
DolDurma Avatar asked Mar 01 '14 11:03

DolDurma


People also ask

How do I change placeholder position in HTML?

In most of the browsers, placeholder texts are usually aligned in left. The selector uses text-align property to set the text alignment in the placeholder. This selector can change browser to browser.

How do I move my placeholder?

Move the mouse pointer over the slanted lines. When a four-headed arrow appears over the borders, click and drag the placeholder to a new location.


2 Answers

I think this can help you.

input[type="text"]:-moz-placeholder {
    text-align: right;
}
input[type="text"]:-ms-input-placeholder {
    text-align: right;
}
input[type="text"]::-webkit-input-placeholder {
    text-align: right;
}

Demo

like image 176
Tushar Avatar answered Nov 09 '22 13:11

Tushar


According to the docs: (http://www.w3.org/html/wg/drafts/html/master/forms.html#the-placeholder-attribute)

In situations where the control's content has one directionality but the placeholder needs to have a different directionality, Unicode's bidirectional-algorithm formatting characters can be used in the attribute value:

like image 42
Moob Avatar answered Nov 09 '22 12:11

Moob