Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 样式选择元素下拉箭头_Javascript_Html_Css_Drop Down Menu_Html Select - Fatal编程技术网

Javascript 样式选择元素下拉箭头

Javascript 样式选择元素下拉箭头,javascript,html,css,drop-down-menu,html-select,Javascript,Html,Css,Drop Down Menu,Html Select,我正在尝试向select元素添加CSS样式和自定义向下箭头。当点击下拉箭头()时,我无法让IE/Firefox通过JavaScript显示下拉列表,这让我很困扰 Square似乎找到了一种方法,可以在不影响浏览器默认行为的情况下设置select元素下拉箭头的样式。。。但我不知道他们是怎么做到的 现场观看: 我看到他们使用的是:before和:after——但这是如何允许单击浏览下拉图像并右键单击下面的选择元素的呢?这是什么诡计 CSS: .dropdown-wrapper i{ bac

我正在尝试向
select
元素添加CSS样式和自定义向下箭头。当点击下拉箭头()时,我无法让IE/Firefox通过JavaScript显示下拉列表,这让我很困扰

Square似乎找到了一种方法,可以在不影响浏览器默认行为的情况下设置
select
元素下拉箭头的样式。。。但我不知道他们是怎么做到的

现场观看:

我看到他们使用的是
:before
:after
——但这是如何允许单击浏览下拉图像并右键单击下面的
选择
元素的呢?这是什么诡计

CSS:

.dropdown-wrapper i{
    background: #FFF;
    background: linear-gradient(#FFF, #FAFAFA);
    border-left-color: rgba(45, 60, 72, 0.12);
    border-radius: 0 3px 3px 0;
    height: 40px;
    line-height: 39px;
    pointer-events: none;
    position: absolute;
    right: 1px;
    top: 1px;
    width: 43px;    
}

.dropdown-wrapper i:before  {
    background: rgba(252, 252, 252, 0);        
    background: linear-gradient(to right, rgba(252, 252, 252, 0), #FCFCFC 20px);        
    content: "";
    height: 40px;
    position: absolute;
    left: -31px;
    top: 0;
    width: 30px;
}

.dropdown-wrapper i:after, .button-dropdown i:after {
    content: "";
    margin-top: -3px;
    pointer-events: none;
    position: absolute;
    right: 15px;
    top: 50%;
}
<div class="dropdown-wrapper">
    <select class="dropdown button">
        <option>Select an option...</option>                
    </select>
    <i></i>
</div>
HTML:

.dropdown-wrapper i{
    background: #FFF;
    background: linear-gradient(#FFF, #FAFAFA);
    border-left-color: rgba(45, 60, 72, 0.12);
    border-radius: 0 3px 3px 0;
    height: 40px;
    line-height: 39px;
    pointer-events: none;
    position: absolute;
    right: 1px;
    top: 1px;
    width: 43px;    
}

.dropdown-wrapper i:before  {
    background: rgba(252, 252, 252, 0);        
    background: linear-gradient(to right, rgba(252, 252, 252, 0), #FCFCFC 20px);        
    content: "";
    height: 40px;
    position: absolute;
    left: -31px;
    top: 0;
    width: 30px;
}

.dropdown-wrapper i:after, .button-dropdown i:after {
    content: "";
    margin-top: -3px;
    pointer-events: none;
    position: absolute;
    right: 15px;
    top: 50%;
}
<div class="dropdown-wrapper">
    <select class="dropdown button">
        <option>Select an option...</option>                
    </select>
    <i></i>
</div>

选择一个选项。。。
如何允许单击浏览下拉图像并右键单击下面的
选择
元素

指针事件:无允许单击浏览图像

如何允许单击浏览下拉图像并右键单击下面的
选择
元素

指针事件:无允许单击浏览图像

如何允许单击浏览下拉图像并右键单击下面的
选择
元素

指针事件:无允许单击浏览图像

如何允许单击浏览下拉图像并右键单击下面的
选择
元素


指针事件:无允许单击浏览图像。

聪明。尽管它在IE11之前不起作用:聪明。尽管它在IE11之前不起作用:聪明。尽管它在IE11之前不起作用:聪明。尽管它在IE11之前不起作用: