覆盖 -webkit-search-cancel-button [英] Override the -webkit-search-cancel-button

查看:32
本文介绍了覆盖 -webkit-search-cancel-button的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试覆盖搜索栏中出现的小 (x),使其不仅仅是清除搜索

I'm trying to override the small (x) that appears in the search bar, to have it do more than clear the search

目前这是我的搜索栏:HTML:

Currently this is my search bar: HTML:

<input type="search" class="form-control" id="inputSearch" placeholder="Search for node" onchange="searchForNode(this)"></div>

CSS:

#inputSearch::-webkit-search-cancel-button{
    position:relative;
    right:20px;    
}

有什么想法吗?谢谢.

推荐答案

DEMO

1) Mozilla 将搜索输入视为文本.但是,对于 Webkit 浏览器(Chrome、Safari),搜索输入的样式为客户端创建的 HTML

1) Mozilla treats search inputs as text. For Webkit browsers however (Chrome, Safari), the search input is styled as a client created HTML

2)

CSS

文章链接

input[type="search"]::-webkit-search-cancel-button {

  /* Remove default */
  -webkit-appearance: none;

  /* Now your own custom styles */
  height: 10px;
  width: 10px;
  background: red;
  /* Will place small red box on the right of input (positioning carries over) */

}

类似问题

这篇关于覆盖 -webkit-search-cancel-button的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆