Set width of native html5 date and time pickers on iOS devices

前端 未结 2 2055
你的背包
你的背包 2021-02-05 05:27

I\'m using the native date and time pickers with type=date and type=time for the mobile version of a website I\'m working on. The input fields are not respecting the css I have,

相关标签:
2条回答
  • 2021-02-05 05:38

    To avoid losing any style elements applied to other input boxes, use textfield instead of none.

    .arriveDate, .arriveTime  {
      -webkit-appearance: textfield;
      -moz-appearance: textfield;
    }
    

    Also, if you just want to make all the date fields appear like textboxes but still work like date fields...

    input[type="date"]
    {
        display:block;
        -webkit-appearance: textfield;
        -moz-appearance: textfield;
        min-height: 1.2em;
    }
    
    0 讨论(0)
  • 2021-02-05 05:52

    Just add this to your styles

    .arriveDate, .arriveTime  {
      -webkit-appearance: none;
      -moz-appearance: none;
    }
    

    The reason behind this is that IOS device render by default the inputs using the IOS buttons

    0 讨论(0)
提交回复
热议问题