cssinputtext-alignios15

How can I align the text of a date input to the left on iOS 15?


On iOS 15, text-align: left; doesn't seem to have an effect on <input type="date" />. The text stays centered when it doesn't completely fill the box. How can I make sure it is aligned to the left using CSS?

Here's a demo: https://stackblitz.com/edit/web-platform-nuv8zt?file=styles.css


Solution

  • Styling the date-and-time-value pseudoelement works for me.

    input::-webkit-date-and-time-value {
        text-align: left;
    }