我想在鼠标悬停时将其颜色更改为图像上的黑色:
但是它不能正常工作,它的工作方式类似于“ https://jsfiddle.net/83vnj5ru/5/”,搜索输入边框未作为一个整体对待,占位符文本颜色在悬停时未更改,光标指针未在悬停时出现过滤器1和过滤器2下拉菜单。你知道为什么吗?
.form-group {
margin-bottom: 0 !important;
}
.input-group-text {
color: gray;
}
.input-group-text:hover {
color: black;
}
.filters {
display: inline-block;
color: gray;
font-weight: bold;
}
.filters i {
font-size: 1.1rem;
color: gray;
font-weight: bold;
}
.search-icon {
background-color: #ffffff !important;
border: 2px solid gray !important;
border-right: 1px solid transparent !important;
}
.search-input {
border-left: 1px solid transparent !important;
border: 2px solid gray;
color: gray;
}
.search-icon:hover {
border-left: 1px solid transparent !important;
border: 2px solid black;
}
.search-input:hover {
border: 2px solid black;
}
.dropdown-toggle::after {
display: none;
}
<div class="bg-custom-gray-dark">
<div class="container py-5">
<div class="row">
<div class="col">
<ul class="list-group">
<li class="list-group-item bg-custom-light2 py-4">
<div class="row align-items-center">
<form class="col-5">
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text search-icon"><i class="fa fa-search"></i></span>
</div>
<input type="text" class="form-control search-input p-0" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Search...">
</div>
</div>
</form>
<div class="col-7 text-right">
<div class="dropdown filters mr-3">
<a class="dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Filter 1 <i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
</div>
</div>
<div class="dropdown filters">
<a class="dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Filter 2 <i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
答案 0 :(得分:1)
使用
.dropdown-toggle:hover { color:black;}
请参见下面的代码段。
.form-group {
margin-bottom: 0 !important;
}
.input-group-text {
color: gray;
}
.input-group-text:hover {
color: black;
}
.filters {
display: inline-block;
color: gray;
font-weight: bold;
}
.filters i{
font-size: 1.1rem;
color: gray;
font-weight: bold;
}
.search-icon {
background-color: #ffffff !important;
border: 2px solid gray !important;
border-right: 1px solid transparent !important;
}
.search-input {
border-left: 1px solid transparent !important;
border: 2px solid gray;
color: gray;
}
.search-icon:hover{
border-left: 1px solid transparent !important;
border: 2px solid black;
}
.search-input:hover{
border: 2px solid black;
}
.dropdown-toggle::after {
display: none;
color:black;
}
.dropdown-toggle:hover{
color:black;
}
input:hover::-webkit-input-placeholder {
color: black;
}
/* Firefox < 19 */
input:hover:-moz-placeholder {
color: black;
}
input:hover::-moz-placeholder {
color: black;
}
input:hover:-ms-input-placeholder {
color: black;
}
HTML:
<div class="bg-custom-gray-dark">
<div class="container py-5">
<div class="row">
<div class="col">
<ul class="list-group">
<li class="list-group-item bg-custom-light2 py-4">
<div class="row align-items-center">
<form class="col-5">
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text search-icon"><i class="fa fa-search"></i></span>
</div>
<input type="text" class="form-control search-input p-0" id="exampleInputEmail1"
aria-describedby="emailHelp" placeholder="Search...">
</div>
</div>
</form>
<div class="col-7 text-right">
<div class="dropdown filters mr-3">
<a class="dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Filter 1 <i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
</div>
</div>
<div class="dropdown filters">
<a class="dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Filter 2 <i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>