Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center the cursor in a text input having a placeholder in Edge without JS?

It works in every browser except Edge. Is there a pure CSS workaround?

input {    text-align: center  }
<input placeholder="placeholder" />
like image 304
Tamás Bolvári Avatar asked Oct 18 '15 00:10

Tamás Bolvári


People also ask

How do I change placeholder position?

You can use the ::placeholder pseudo-element to change the styles of the placeholder text, which includes the ability to change the background.


1 Answers

Nice find, Tamás! This appears to be a bug with our form controls. Note that the cursor respects the instruction when there is no placeholder, but falls back to left-alignment when there is a placeholder. This seems very unintentional, and worth digging into.

like image 76
Sampson Avatar answered Oct 07 '22 06:10

Sampson