日期输入,例如<input type="date" name="due_date" id="due_date" min="2011-09-01" maxlength="10" class="span8">
Chrome 中曾经允许用户看到“弹出”日历来帮助选择日期。昨天我注意到这种行为已经停止了;输入仅允许用户向上/向下箭头移动日期部分(月/日/年)。我访问了 Chrome 博客并运行了 Google 搜索,但找不到任何提及此更改的信息。为什么会有这样的行为input type="date"
改变了?奇怪的是,这种变化似乎仅限于 Bootstrap,因为http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_date http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_date仍然展示日期选择器。
UpdateChromium 团队接受了该错误并提交了一份修补回 WebKit https://bugs.webkit.org/show_bug.cgi?id=110974。
更改的要点是,无论应用于 input[type='date'] 控件的样式如何,日期控件都将在灵活的框元素内呈现。
我就是被选择的那一位。一种建议的解决方案是应用 display: inline-block;到日历选择器:
input[type="date"]::-webkit-calendar-picker-indicator{
display:inline-block;
}
然而,这是一个不稳定的解决方案,因为控件仍然被移动到 input[type="date"] 控件上右对齐以外的位置。
另一种选择是向右浮动:
input[type="date"]::-webkit-calendar-picker-indicator {
display:inline-block;
margin-top:2%;
float:right;
}
input[type="date"]::-webkit-inner-spin-button {
display:inline-block;
float:right;
}
这具有颠倒旋转器和日历选择器控件的副作用。
我认为最好的技巧是删除微调器并向右浮动:
input[type="date"]::-webkit-calendar-picker-indicator{
display:inline-block;
margin-top:2%;
float:right;
}
input[type="date"]::-webkit-inner-spin-button {
/* display: none; <- Crashes Chrome on hover */
-webkit-appearance: none;
margin: 0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)