Posted in
259
5:22 am, May 6, 2026
simple svg play button with circle overlay
Just put it anywhere you like! to get a centered play button in a div, no actual image file required.
I added this svg and then thought i would build a lightbox video modal around it as well.
just need to add a video source for the lightbox to load the video.
HTML
<div class="custom-video-lightbox">
<a href="https://www.youtube.com/watch?v=EI18oB4-i8M" class="glightbox video-trigger">
<img src="https://img.youtube.com/vi/EI18oB4-i8M/hqdefault.jpg" alt="Watch our video">
<div class="play-button-overlay">
<svg viewBox="0 0 24 24" fill="white" width="64" height="64"><path d="M8 5v14l11-7z"/></svg>
</div>
</a>
</div>CSS
/* Custom Video Lightbox Wrapper */
.custom-video-lightbox {
position: relative;
width: 100%;
max-width: 100%; /* Adjust if you want the video thumbnail smaller */
overflow: hidden;
border-radius: 8px; /* Optional: rounds the corners of the thumbnail */
cursor: pointer;
}
.custom-video-lightbox img {
width: 100%;
height: auto;
display: block;
transition: transform 0.3s ease; /* Smooth zoom effect on hover */
}
/* Play Button Overlay Positioning */
.custom-video-lightbox .play-button-overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.6);
border-radius: 50%;
padding: 15px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.3s ease;
}
/* Hover Effects */
.custom-video-lightbox:hover img {
transform: scale(1.02);
}
.custom-video-lightbox:hover .play-button-overlay {
background: rgba(46, 96, 70, 0.9); /* Changes play button background to your green */
}Scripts
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/glightbox/dist/css/glightbox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const lightbox = GLightbox({
selector: '.glightbox', // Targets the class in our HTML
touchNavigation: true,
loop: false,
autoplayVideos: true // Autoplays the video once the lightbox opens
});
});
</script>
View Statistics
This Week
13
This Month
169
This Year
169
Add Comment
Other Items in svg
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps ai animation apache api apps asp bat blocking bootstrap bootstrap templates charts cookies core css css filters css grid css tips design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac minecraft misc modal modals mysql nginx node php php errors php function php functions php simple html dom pi400 proxmox python react regex sections simple_html_dom simplepie php site bugs site documentation slick slick slider sql sqlite ssh sublime svg svg css templates test tools video virtual box vscode vue webdev windows windows 11 windows commands wordpress youtube