<div id="app-idea">A popup modal open and close without using JavaScript</div>
<div id="cover">
<input type="checkbox" id="checkbox">
<div id="label">Open the popup</div>
<div id="modal">Do you accept Jesus Christ as your Lord and Savior?</div>
<div id="yep">i accept</div>
</div>
* {
outline: none;
}
body {
margin: 0px;
font-family: Roboto;
background-color: #2196f3;
}
#app-idea {
text-align: center;
padding: 20px;
padding-bottom: 25px;
font-size: 32px;
color: #fff;
font-weight: bold;
border-bottom: 1px solid #1978c4;
}
#cover {
width: 188px;
margin: 110px auto;
position: relative;
}
#checkbox {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
margin: 0px;
opacity: 0;
cursor: pointer;
z-index: 1;
}
#label {
font-size: 20px;
text-align: center;
padding: 20px;
}
#label:after {
content: "";
position: fixed;
top: 0px;
left: 0px;
width: 0px;
height: 0px;
background-color: #2196f3;
z-index: 1;
}
#modal {
right: 0px;
left: 0px;
max-width: 460px;
font-size: 42px;
padding: 25px;
margin: 0 auto;
border: 10px solid #f5f5f5;
}
#yep {
width: 93px;
font-size: 20px;
text-align: center;
text-transform: uppercase;
padding: 20px;
cursor: pointer;
}
#label,
#modal,
#yep {
background-color: #fff;
border-radius: 2px;
box-shadow: 0px 20px 40px #1462a1;
}
#modal,
#yep {
position: fixed;
color: #2196f3;
font-weight: bold;
transform: scale(0);
transition: 0.2s cubic-bezier(0, 0.79, 0.52, 1.28) transform;
z-index: 1;
}
#checkbox:checked {
left: auto;
width: 133px;
height: 64px;
z-index: 3;
}
#yep,
#checkbox:checked {
position: fixed;
right: 30px;
}
#modal,
#yep,
#checkbox:checked {
top: 114px;
}
#checkbox:checked + #label:after {
width: 100%;
height: 100%;
}
#checkbox:checked ~ #modal,
#checkbox:checked ~ #yep {
transform: scale(1);
z-index: 2;
}
This Pen doesn't use any external JavaScript resources.