css - 从自动样式输入 type=search 中停止 chrome

标签 css google-chrome

有没有办法阻止 Chrome 对 input type=search 进行样式设置。当输入是 input type=text 时,我可以很好地设置输入样式,尽管一旦我将其更改为 HTML5 搜索,它就会包含我已应用于输入的所有样式。

类型 = 文本

text

类型=搜索

serach

更新了具有重置属性的答案

input[type="search"] {
    -webkit-appearance: textfield;
}

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  {
    -webkit-appearance: none;
}

最佳答案

你可以试试:

input[type="search"] {
    -webkit-appearance: textfield;
}

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

有帮助吗?

关于css - 从自动样式输入 type=search 中停止 chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11538192/

相关文章:

html - 使用 flexbox 对齐 div 文本

javascript - 列宽异常

html - 在多个 div 上居中 div

javascript - window.open() 在 chrome 中打开一个空白屏幕

javascript - chrome.storage.local.set() 无法正常工作

html - 如何居中下拉菜单?

css - 屏幕阅读器能看到背面可见性吗?

google-chrome - Chrome扩展程序可从各种 session 软件捕获音频

google-chrome - Chrome的奇怪 `gpu-preferences`

Javascript:通过 ID 更新元素?