【问题标题】:input type search hide the icons输入类型搜索隐藏图标
【发布时间】:2013-09-22 06:27:42
【问题描述】:

在 chrome 中,当我在搜索字段中键入时,会出现一个 cross,单击该字段会清除该字段(也可以使用 Esc 来实现)。

  <input type="search">

有什么办法可以隐藏这个十字架吗?


编辑:

如果您使用属性results="2",它也会开始显示放大镜。这是什么魔法?为什么我使用results 属性时会出现玻璃?

<input type="search" results="2">

【问题讨论】:

标签: html


【解决方案1】:

Sourabh 你需要禁用 WebKit 的专有伪元素

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

如果这有帮助,请告诉我

供您使用:

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}
<input type="search">

【讨论】:

  • 为什么所有不必要的 CSS 引用?
猜你喜欢
  • 2013-03-16
  • 2015-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-25
相关资源
最近更新 更多