CSS淡出其他

CSS淡出其他,css,hover,Css,Hover,您好,我正在尝试创建一个悬停效果,因此当有人将鼠标悬停在带有LI元素的图像上时,该图像将保持完全不透明度,但oitehr LI元素会稍微淡出。我知道这是可以做到的,但目前我的代码正在使一切淡出 请在我的密码下面找一把小提琴 非常感谢您的帮助 .imageWrapper { position: relative; z-index: 5; } .imageWrapper:after { content: " "; position: absolute; width: 100%;

您好,我正在尝试创建一个悬停效果,因此当有人将鼠标悬停在带有LI元素的图像上时,该图像将保持完全不透明度,但oitehr LI元素会稍微淡出。我知道这是可以做到的,但目前我的代码正在使一切淡出

请在我的密码下面找一把小提琴

非常感谢您的帮助

.imageWrapper {
  position: relative;
  z-index: 5;
}

.imageWrapper:after {
  content: " ";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: block;
  z-index: 10;
  transition: background 0.3s linear;
}

.cpClientIcon {
  /*
  .cpImageWithTitle {
    .title {
      @include opacity(0);
      transition:opacity 0.3s linear;
    }
  }
*/
}

.cpClientIcon:hover .imageWrapper:after, .cpClientIcon:focus .imageWrapper:after, .cpClientIcon:active .imageWrapper:after {
  background: red;
}

.cpClientIcon:hover .imageWrapper:hover, .cpClientIcon:hover .imageWrapper:focus, .cpClientIcon:hover .imageWrapper:active, .cpClientIcon:focus .imageWrapper:hover, .cpClientIcon:focus .imageWrapper:focus, .cpClientIcon:focus .imageWrapper:active, .cpClientIcon:active .imageWrapper:hover, .cpClientIcon:active .imageWrapper:focus, .cpClientIcon:active .imageWrapper:active {
  /*
        .title {
          @include opacity(1);
        }
*/
}

.cpClientIcon:hover .imageWrapper:hover .imageWrapper:after, .cpClientIcon:hover .imageWrapper:focus .imageWrapper:after, .cpClientIcon:hover .imageWrapper:active .imageWrapper:after, .cpClientIcon:focus .imageWrapper:hover .imageWrapper:after, .cpClientIcon:focus .imageWrapper:focus .imageWrapper:after, .cpClientIcon:focus .imageWrapper:active .imageWrapper:after, .cpClientIcon:active .imageWrapper:hover .imageWrapper:after, .cpClientIcon:active .imageWrapper:focus .imageWrapper:after, .cpClientIcon:active .imageWrapper:active .imageWrapper:after {
  background: transparent;
}

/* Clients Page */
.cpClientIcon {
  background: #fff;
}

.cpClientIcon.ClientIcon {
  width: 100%;
}

.cpClientIcon.ClientIcon ul li {
  width: 25%;
  display: inline-block;
  padding: 0;
  margin: 0;
  float: left;
}

.cpClientIcon.ClientIcon ul li.imageWrapper {
  position: relative;
}

.cpClientIcon.ClientIcon ul li.imageWrapper span {
  position: absolute;
  bottom: 0;
  opacity: 0;
  transform: translate(-50%, 0);
  left: 50%;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  width: 100%;
  text-align: center;
  padding: 1em 0;
  transition: all 0.5s ease;
}

.cpClientIcon.ClientIcon ul li.imageWrapper:hover span {
  opacity: 1;
}

.cpClientIcon.ClientIcon ul li img {
  width: 100%;
  height: auto;
}

UL
设置悬停规则,将所有子
LI
元素设置为所需的淡出不透明度,然后为
LI
设置悬停规则,将不透明度设置回完全不透明:

ul:hover li {
  opacity: 0.5;
}

ul:hover li:hover {
  opacity: 1;
}
例如:
UL
设置悬停规则,将所有子
LI
元素设置为所需的淡出不透明度,然后为
LI
设置悬停规则,将不透明度设置回完全不透明:

ul:hover li {
  opacity: 0.5;
}

ul:hover li:hover {
  opacity: 1;
}
例如: 您也可以使用:

li a{
背景:rgba(255,255,255,0.5);
显示:内联块;
宽度:100%;
}
李*{
混合模式:柔和的光线;
}
李:悬停*{
混合模式:未设置;
}
li{显示:内联块;宽度:20%;}
img{最大宽度:100%;}

您也可以使用:

li a{
背景:rgba(255,255,255,0.5);
显示:内联块;
宽度:100%;
}
李*{
混合模式:柔和的光线;
}
李:悬停*{
混合模式:未设置;
}
li{显示:内联块;宽度:20%;}
img{最大宽度:100%;}


您可以将鼠标悬停设置为父元素,并将其用于如下所示的子元素。父元素:hover.child{style;}。。。您不能通过仅悬停子元素来影响同级或父级。您可以将悬停设置为父级元素,并将其用于如下所示的子级。父级:悬停。子级{styles;}。。。您不能通过将独生子女元素悬停在您的男性身上来影响兄弟姐妹或父母。谢谢你做了这么简单的事情,结果证明很棘手;)你的丈夫。谢谢你做了这么简单的事情,结果证明很棘手;)