CSS-Only Video Modal

Pop up window shows embedded video combining snippets from labnol and embed responsively.


CSS

 /*Modal*/
.overlay img {
	display: block!important;
	margin: auto!important;
	max-width: 100%!important;
}

.modal-window {
	position: fixed;
	background-color: rgba(255, 255, 255, 0.25);
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s;
}

.modal-window:target {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.modal-window>div {
	width: 80%;
	max-width: 1000px;
	position: absolute;
	top: 50%;
	left: 50%;
	-webkit-transform: translate(-50%, -50%);
	transform: translate(-50%, -50%);
	padding: 3em;
	background: #ffffff;
	box-shadow: 5px 5px 20px;
}

.modal-close {
	color: #aaa;
	line-height: 35px;
	font-size: 80%;
	position: absolute;
	right: 0;
	text-align: center;
	top: 0;
	width: 70px;
	text-decoration: none;
}

.modal-close:hover {
	color: black;
}
.embed-container {
	position: relative;
	padding-bottom: 56.25%;
 	height: 0;
	overflow: hidden;
	max-width: 100%; 
}

.embed-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

@media only screen and (max-width: 600px) {
	.modal-window>div {
		padding: 1em;
		top: 35%;
	}
	.modal-close { 
    line-height: unset;
	}
 
}

HTML

 <section>
   <div class="overlay">
      <a href="#video1" ><img src="../images/play.jpg" width="550" ></a>
   </div>
</section>
<!--Video modal-->
<div id="video1" class="modal-window">
   <div>
      <a href="#video" class="modal-close">Close</a>
      <div>
         <div class='embed-container'>
            <div><iframe src='https://www.youtube.com/embed/oFRFaI0Ntvk' frameborder='0' allowfullscreen></iframe></div>
         </div>
      </div>
   </div>
</div>