如何摆脱输入日期的 x 和向上/向下箭头元素? [英] How to get rid of x and up/down arrow elements of a input date?
问题描述
我唯一需要在框中显示的是橙色三角形,我不确定是否需要 CSS 或其他东西来摆脱三角形左侧的两个元素.
The only thing that I need showing up in the box there is the orange triangle, and I am not sure if I need CSS or something else to get rid of the two elements to the left of the triangle.
有没有办法做到这一点?我只是使用输入类型 date
.
Is there a way to do so? I am just using the input type date
.
小提琴:http://jsfiddle.net/5M2PD/1/
推荐答案
使用伪类 -webkit-inner-spin-button
来设置特定于基于 webkit 的浏览器的样式:
Use the pseudo-class -webkit-inner-spin-button
to style it specific for webkit-based browsers:
input[type=date]::-webkit-inner-spin-button {
-webkit-appearance: none;
display: none;
}
如果你想改变下拉箭头的样式,使用伪类-webkit-calendar-picker-indicator
:
If you want to change the style of the dropdown arrow, use the pseudo-class -webkit-calendar-picker-indicator
:
input[type=date]::-webkit-calendar-picker-indicator {
-webkit-appearance: none;
display: none;
}
要消除清除按钮,请将输入设置为必需:
To eliminate the clear button, set the input to required:
<input type="date" required="required" />
这篇关于如何摆脱输入日期的 x 和向上/向下箭头元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!