问题描述
我正在尝试使用常规输入类型的日期在移动设备上使用.但是Safari(或Webkit)否决了CSS中设置的宽度.
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).
我可以在CSS中添加-webkit-appearance: none;
,这样宽度将按预期工作.但是随后,我失去了所有其他想要的样式,例如,箭头指示它是一个选择器.
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?
推荐答案
-webkit-appearance: none;
总是会删除选择器的典型样式...但是您可以使用CSS和背景图片轻松添加箭头.
-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.
这篇关于iOS上Safari中的输入类型日期外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!