Result
よく見るやつです。テキストは遅延表示されます
css
.tiles {/全体*/ font-size: 0; text-align: center; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .tiles .tile {/*コンテナのスタイル*/ display: inline-block; margin: 10px; text-align: left; opacity: .99; overflow: hidden; position: relative; border-radius: 3px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05); } .tiles .tile:before {/*疑似要素を追加して重ねておく*/ content: ''; background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%); width: 100%; height: 50%; opacity: 0; position: absolute; top: 100%; left: 0; z-index: 2; transition-property: top, opacity; transition-duration: 0.3s; } .tiles .tile img { display: block; max-width: 100%; backface-visibility: hidden; } .tiles .tile .details {/*テキスト部分*/ font-size: 16px; padding: 20px; color: #fff; position: absolute; bottom: 0; left: 0; z-index: 3; } .tiles .tile .details span { display: block; opacity: 0; position: relative; top: 100px; transition-property: top, opacity; transition-duration: 0.3s; transition-delay: 0s; } .tiles .tile .details .title { line-height: 1; font-weight: 600; font-size: 18px; } .tiles .tile .details .info { line-height: 1.2; margin-top: 5px; font-size: 12px; } .tiles .tile:focus:before, .tiles .tile:focus span, .tiles .tile:hover:before, .tiles .tile:hover span {/*ホバー時に表示*/ opacity: 1; } .tiles .tile:focus:before, .tiles .tile:hover:before {/*表示と同時に動かす*/ top: 50%; } .tiles .tile:focus span, .tiles .tile:hover span { top: 0; } .tiles .tile:focus .title, .tiles .tile:hover .title {/*テキストだけ遅延させる*/ transition-delay: 0.15s; } .tiles .tile:focus .info, .tiles .tile:hover .info {/*さらに遅延*/ transition-delay: 0.25s; }
html
<div class="tiles"> <a class="tile" href="#"> <img src="https://picsum.photos/200/350?image=100"/> <div class="details"> <span class="title">foo</span> <span class="info">hogehoge</span> </div> </a> </div>