Input type date appearance in Safari on iOS

后端 未结 4 397
感情败类
感情败类 2021-01-11 09:33

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-appea

相关标签:
4条回答
  • 2021-01-11 10:17

    if you want select only input[type='date'] and input[type='time'] try this CSS line.

    input[type='date'], input[type='time'] {
        -webkit-appearance: none;
    }
    
    0 讨论(0)
  • 2021-01-11 10:20

    -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.

    0 讨论(0)
  • 2021-01-11 10:32

    I have found that to get 100% width correct as per @Boldizsar answer you need a little CSS calc action to remove the width added by the dropdown arrow on iOS.

    -webkit-min-logical-width: calc(100% - 16px);
    
    0 讨论(0)
  • 2021-01-11 10:37

    Add -webkit-min-logical-width: <your desired value>. It solved the problem for me!

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