【发布时间】:2018-11-07 20:39:36
【问题描述】:
我正在尝试像这样在悬停图像上的文本上设置 css 过渡 -> https://victorthemes.com/themes/glazov/portfolio-grid/
我尝试使用cubic-bezier() 函数执行此操作,但没有结果。
这是我的代码。
* {
margin: 0;
padding: 0;
border: 0;
}
.img__wrap {
position: relative;
height: 200px;
width: 257px;
}
.img__description {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(29, 106, 154, 0.72);
color: #fff;
visibility: hidden;
opacity: 0;
transition: opacity .2s, visibility .2s;
}
.img__wrap:hover .img__description {
visibility: visible;
opacity: 1;
}
<div class="img__wrap">
<img class="img__img" src="http://placehold.it/257x200.jpg" />
<p class="img__description">Teext.</p>
</div>
请给我一些提示如何做到这一点。
【问题讨论】:
-
您在寻找哪种效果?缩放图像?移动文本?包裹不透明度?
-
我正在寻找移动文本效果。