Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input type date appearance in Safari on iOS

I'm trying to use a regular input type date to use on mobile devices. But the width set in the CSS is overruled by Safari (or webkit).

I can add -webkit-appearance: none; to the CSS and by that, the width will work as expected. But then I lose all the other styling that is wanted, for example the arrow to indicate that it is a picker.

Is there a way that I can keep the basic styling of an input type date, but rule over the width myself?

like image 290
SamJ Avatar asked Aug 22 '13 13:08

SamJ


People also ask

Does Safari support date input?

Date and time input types is Partially Supported on Safari 15, which means that any user who'd be accessing your page through Safari 15 can see it perfectly.

How do I display the date format in input?

To set and get the input type date in dd-mm-yyyy format we will use <input> type attribute. The <input> type attribute is used to define a date picker or control field. In this attribute, you can set the range from which day-month-year to which day-month-year date can be selected from.

What is the input type for date?

The <input type="date"> defines a date picker. The resulting value includes the year, month, and day.


1 Answers

-webkit-appearance: none; does always remove the typical style of a picker... But you can easily add an arrow using CSS and a background-image.

I'm not aware of a way to custom style the input but also keeping the arrow.

like image 169
Dion Avatar answered Oct 08 '22 01:10

Dion