You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Firefox中隐藏HTML date类型输入框的日历图标?

Firefox下隐藏日历图标解决方案

Chrome的方案仅针对WebKit内核浏览器生效,Firefox基于Gecko内核,需要用它专属的伪元素来处理:

/* 重置浏览器默认外观 */
input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* 处理Chrome/Safari端的图标和微调按钮 */
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}

/* 关键:Firefox端隐藏日历图标 */
input[type="date"]::-moz-calendar-picker-indicator {
  display: none;
}

/* 可选优化:如果隐藏图标后输入框右侧有多余留白,调整padding适配移动端 */
input[type="date"] {
  padding-right: 0.5em;
}

核心就是利用::-moz-calendar-picker-indicator这个Firefox专属伪元素,直接设置它不显示就能隐藏日历图标。如果调整后输入内容有截断问题,按需修改padding值即可,完全适配移动端场景。

内容的提问来源于stack exchange,提问作者Ronny Efronny

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 17:37:00