如何去掉搜索栏上的“X”

Bar*_*jar 0 css

我试图摆脱在搜索栏中写入内容时显示的“X”按钮,或者至少更改它:

<input type="search">
Run Code Online (Sandbox Code Playgroud)

我尝试了以下CSS:

input[type="search"]{-webkit-appearance: none;}
Run Code Online (Sandbox Code Playgroud)

还有一些 webkit 的东西不起作用。

Pra*_*man 8

我尝试在 Google 上搜索input type text remove close. 我得到了这个结果。您可以使用以下代码在 Chrome 或 Internet Explorer 上将其删除。

/* clears the 'X' from Internet Explorer */
input[type=search]::-ms-clear {  display: none; width : 0; height: 0; }
input[type=search]::-ms-reveal {  display: none; width : 0; height: 0; }

/* clears the 'X' from Chrome */
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; }
Run Code Online (Sandbox Code Playgroud)
<input type="search" />
Run Code Online (Sandbox Code Playgroud)

我从以下位置获得了上述代码:从 Internet Explorer 和 Chrome 输入类型搜索中删除 X | 马克西姆·鲁耶尔

刚刚发现它可能是某些输入上删除 IE10 的“清除字段”X 按钮的重复?