mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-10-23 02:36:11 +02:00
1.2 KiB
1.2 KiB
layout, title, description, keywords
layout | title | description | keywords |
---|---|---|---|
layouts/post.njk | Overlay play button | Create an overlay play button with CSS flexbox | css flexbox |
HTML
<div class="overlay-play-button">
<!-- The video element -->
<video src="..." />
<!-- The overlay area -->
<div class="overlay-play-button__overlay">
<!-- The player button -->
<div class="overlay-play-button__play">
...
</div>
</div>
</div>
CSS
.overlay-play-button {
/* Used to position the overlay */
position: relative;
}
.overlay-play-button__overlay {
/* Position */
left: 0;
position: absolute;
top: 0;
/* Take full size */
height: 100%;
width: 100%;
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
/* Add a dark background */
background-color: rgba(0, 0, 0, 0.25);
}
.overlay-play-button__play {
border: 0.25rem solid #FFF;
border-radius: 9999px;
height: 3rem;
width: 3rem;
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
}
{% demo %} {% include "covers/overlay-play-button.njk" %} {% enddemo %}