Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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
Html 为什么可以';我不能更改下拉图标吗?_Html_Css_Bootstrap 4 - Fatal编程技术网

Html 为什么可以';我不能更改下拉图标吗?

Html 为什么可以';我不能更改下拉图标吗?,html,css,bootstrap-4,Html,Css,Bootstrap 4,我无法将我的下拉图标从默认的“胡萝卜”更改为“胡萝卜” 我读过其他问题,但没有一个对我有用 <form> <div class="form-group"> <select disabled class="custom-select"> <option selected>Región Metropolitana</option> </select> </div> <div class="for

我无法将我的下拉图标从默认的“胡萝卜”更改为“胡萝卜”

我读过其他问题,但没有一个对我有用

<form>
 <div class="form-group">
  <select disabled class="custom-select">
   <option selected>Región Metropolitana</option>
  </select>
</div>
<div class="form-group">
 <select class="custom-select">
   <option selected>Comuna</option>
   <option>One</option>
   <option>Two</option>
   <option>Three</option>
  </select>
 </div>
</form>


.form-group .custom-select:disabled {
   background: none;
}

.form-group .custom-select::after {
  content: '\f107';
  font-family: "Font Awesome\ 5 Free";
  font-size: 1em;
  font-weight: bold;
  pointer-events: none;
  position: absolute;
  left: auto;
  top: 50px;
  z-index: 9;
  color: red;
}

大都会区
科穆纳
一
二
三
.form组。自定义选择:禁用{
背景:无;
}
.form group.custom select::after{
内容:'\f107';
字体系列:“字体很棒\5免费”;
字号:1em;
字体大小:粗体;
指针事件:无;
位置:绝对位置;
左:自动;
顶部:50px;
z指数:9;
颜色:红色;
}
我的下拉列表应显示以下图标:


您不能将::after与select一起使用。我和你有同样的问题。最好的方法是使用CSS背景图像来定制箭头。例如:

select {
    background-color: white;
    background-image: url('../Images/Generic/arrowDownBlack.png');
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 20px 20px;
}

select::-ms-expand {
    display: none; //This gets rid of the arrow in IE.
}
如果你使用矢量图像,它将和字体一样好


为了证明我是对的,您可以尝试将::after添加到另一个元素中。它会显示出来,而不是选择。

你用[bootstrap-4]标记了你的问题,那么为什么不使用bootstrap方法来构建下拉列表呢?