<figure class="cp_caption">
<img src="img.jpg">
<figcaption>
<h2>タイトル</h2>
<p>テキスト</p>
<a href="#"></a>
</figcaption>
</figure>
figure.cp_caption {
position: relative;
overflow: hidden;
width: 100%;
min-width: 220px;
max-width: 300px;
max-height: 220px;
margin: 10px 1%;
color: #ffffff;
}
figure.cp_caption * {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
figure.cp_caption img {
width: 100%;
height: 100%;
}
figure.cp_caption figcaption {
position: absolute;
z-index: 1;
top: 50%;
padding: 3em 3em;
transition: all 0.3s ease-out;
transition-delay: 0.1s;
opacity: 0;
}
figure.cp_caption:after {
position: absolute;
top: 7%;
right: 10%;
bottom: 7%;
left: 10%;
display: inline-block;
content: '';
transition: all 0.3s ease-out;
opacity: 0;
background: rgba(27, 37, 56, 0.8);
}
figure.cp_caption:hover:after {
opacity: 0.9;
}
figure.cp_caption:hover figcaption {
transform: translateY(-50%);
opacity: 1;
}