简体   繁体   English

容器 hover 效果 变色文字带背景 hover 效果 css

[英]Container hover effect color change text with backgound hover effect css

When I click hover in slide-image so hover effect change but text color have to changed how to text color changed with slide-image hover effect?当我在幻灯片图像中单击 hover 时,hover 效果发生变化,但文本颜色必须改变如何使用幻灯片图像 hover 效果更改文本颜色?

.wpcp-slide-image::before {
    content:"";
    position: absolute;
    top:0px;
    left: 0px;
   opacity: 0.7 !important;
    background-color: #ff613c;
    width: 100%;
    height: 0%;
    transition: height 0.15s ease-in;

}

.wpcp-slide-image:hover::before{
    height: 100% !important;
}

enter image description here在此处输入图像描述

you should set the z-index of the image on -1, so the background will be behind the text.您应该将图像的 z-index 设置为 -1,这样背景就会位于文本后面。

CSS: CSS:

.wpcp-slide-image:hover .abc {
  color: white;
}
.wpcp-slide-image::before {
    content:"";
    position: absolute;
    top:0px;
    left: 0px;
   opacity: 0.7 !important;
    background-color: #ff613c;
    width: 100%;
    height: 0%;
    transition: height 0.15s ease-in;
  z-index: -1;

}

.wpcp-slide-image:hover::before{
    height: 100% !important;
}

HTML: HTML:

<div class="wpcp-slide-image">
  <div class="abc">abc</div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM