我了解我要修改的元素不在overlay
div之外,但是我正在寻找新颖的方法来应用CSS过滤器,现在它被应用于覆盖层而不是容器元素
filter: brightness(0%) sepia(1) invert(1);
这里的目标是在覆盖层上方改变元素的颜色
.item:hover .item-overlay.top {
top: 0;
}
.item:hover .item-overlay.right {
right: 0;
left: 0;
}
.item:hover .item-overlay.bottom {
bottom: 0;
}
.item:hover .item-overlay.left {
left: 0;
}
.item-overlay {
position: absolute;
filter: brightness(0%) sepia(1) invert(1);
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
overflow: hidden;
text-align: center;
width: 100%;
transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s;
}
.item-overlay.top {
top: 100%;
}
.item-overlay.right {
right: 200%;
left: -100%;
}
.item-overlay.bottom {
bottom: 100%;
}
.item-overlay.left {
left: 100%;
}
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
}
.item {
position: relative; /* filter: brightness(0%) sepia(1) invert(1); */
background-color: #eee;
color: #111;
float: left;
overflow: hidden;
width: 936px;
height: 288px;
}
<div class="item">
<img class="logo" src='https://image.flaticon.com/icons/svg/1353/1353983.svg' width='50' />
<p>Coming soon</p>
<h1>12:59:33</h1>
<div class="item-overlay right"></div>
</div>