CSS Only Video Lightbox
How do I make an css only video lightbox?
Would probably use JS to stop playback on close, but not really inline with my goal for this exercise.. What is a css only video lightbox? How do you make a css only video lightbox? This script and codes were developed by Drew McConville on 31 August 2022, Wednesday.
CSS Only Video Lightbox - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Only Video Lightbox</title> <script src="https://use.typekit.net/uqf0mlo.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="flex"> <label class="btn" for="show-vid">Show Video</label>
</div>
<input id="show-vid" type="checkbox" />
<div id="overlay" for="show-vid"> <div class="video-wrapper"> <label class="close" for="show-vid">Hide Video</label> <iframe width="560" height="315" src="https://www.youtube.com/embed/ScMzIvxBSi4" frameborder="0" allowfullscreen></iframe> </div>
</div>
</body>
</html>
CSS Only Video Lightbox - Script Codes CSS Codes
@charset "UTF-8";
input[type="checkbox"] { display: none;
}
.flex { display: flex; align-items: center; height: 100vh;
}
.close { width: 2rem; height: 2rem; background-color: rgba(255, 255, 255, 0.85); border-radius: 100%; display: block; font-size: 1px; text-indent: -999em; position: absolute; border: 1px solid #000; top: -1rem; right: -1rem; z-index: 999; box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.35); transition: all 0.25s ease-out;
}
.close:hover, .close:focus { transform: scale(1.1); background-color: white;
}
.close:after { font-weight: 300; content: "×"; text-indent: 0; font-size: 1.4rem; position: absolute; top: 0.15rem; left: 0.525rem;
}
.btn { font-family: "tondo", sans-serif; cursor: pointer; border: 1px solid #aaa; margin: 0 auto 3em; display: block; width: 200px; text-align: center; padding: 0.75em 1em; box-sizing: border-box; text-transform: uppercase; letter-spacing: 0.2em; transition: all 0.1s ease;
}
.btn:hover, .btn:focus { background-color: #333; border: 1px solid #333; color: white;
}
#overlay { transition: opacity 0.35s ease; padding: 0em; box-sizing: border-box; opacity: 0; display: flex; align-items: center; position: absolute; background-color: rgba(0, 0, 0, 0.85); width: 1px; height: 1px; top: 0; left: 0;
}
#overlay > * { display: none;
}
input:checked + #overlay { width: 100%; height: 100%; padding: 1em; opacity: 1;
}
@media (min-width: 500px) { input:checked + #overlay { padding: 2em; }
}
@media (min-width: 900px) { input:checked + #overlay { padding: 4em; }
}
input:checked + #overlay > * { display: block;
}
.video-wrapper { box-sizing: border-box; min-width: 100%; position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0;
}
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
![CSS Only Video Lightbox - Script Codes](http://shots.codepen.io/drew_mc/pen/grWbKW-512.jpg)
Developer | Drew McConville |
Username | drew_mc |
Uploaded | August 31, 2022 |
Rating | 3 |
Size | 3,250 Kb |
Views | 36,432 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
My submissions for a digital business card challenge | 3,364 Kb |
Donation UI Concept | 7,135 Kb |
SVG Sprite - Credit Card Icons | 4,848 Kb |
Burger Style Navigation Button | 4,172 Kb |
Unminified markup for bettermotherfuckingwebsite.com | 2,956 Kb |
Basic Hidden Form | 3,467 Kb |
A Pen by Drew McConville | 1,775 Kb |
Box Shadow Evolution | 1,911 Kb |
Input modification feedback | 4,097 Kb |
Avg Donation Firework Effect for Bernie 2016 project | 5,818 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Add This API | ThatGuySam | 2,848 Kb |
Blog demo to use given styling | Andygirl | 2,412 Kb |
CSS Link Icons with jQuery Titles | Nicwinn | 2,312 Kb |
RPG Style Text Dialogue | Odylic | 2,635 Kb |
Cool Page Split Effect | Anthonyadamski | 6,128 Kb |
A cube | KyleDavidE | 18,627 Kb |
C.Rowe Button | Brownerd | 2,473 Kb |
FCC - Tribute Page | Cmwebby | 0 Kb |
Polo, the flying squirrel | Agbales | 2,445 Kb |
VerbalExpressions Converter | Cmalven | 2,607 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!