所以我有这个 HTML 代码:
<a class="caption caption-1" data-title="Offer 1" data-description="desc">
<img src="photos/1.jpg" alt="Illustration of Cafe Racer">
</a>
.caption-1::before,
.caption-1::after {
opacity: 0;
position: absolute;
width: 100%;
color: #fff;
padding: 20px;
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
transition: opacity 0.3s;
}
.caption-1::before {
content: attr(data-title);
top: 0;
height: 30%;
background: #a21f00;
font-size:100%;
font-weight: 300;
}
.caption-1::after {
content: '\201C' attr(data-description) '\201D';
top: 30%;
height: 70%;
background: #db2e00;
font-size: 100%;
text-align: right;
}
我有这张名为 .caption-1 的图片:
http
://cl.ly/image/2r1v3z223F07 当我将其悬停时,它会显示为:http://cl.ly/image/3C2Y2p2E0H3D 这
两个
文本分别位于在:之前和:之后,所以我想用文本填充整个框。