【问题标题】:Stop chrome from auto styling input type=search停止 chrome 从自动样式输入 type=search
【发布时间】:2012-07-17 07:13:07
【问题描述】:

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

类型 = 文本

类型 = 搜索

使用重置属性更新答案

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;
}

【问题讨论】:

  • 刚刚上传的图片显示了我的意思

标签: css google-chrome


【解决方案1】:

你可以试试:

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

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

有帮助吗?

【讨论】:

    【解决方案2】:

    看看这个页面,可能会有所帮助:)

    http://css-tricks.com/webkit-html5-search-inputs/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-23
      相关资源
      最近更新 更多