Created
June 5, 2019 17:12
-
-
Save kewang/c1f6a80d2db440fdb8663a74190e26c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Pure CSS3 Lightbox start */ | |
a.button { | |
display: inline-block; | |
background: #999; | |
color: #f2f2f2; | |
-moz-border-radius: 5px; | |
-webkit-border-radius: 5px; | |
border-radius: 5px; | |
padding: 10px 1em; | |
-moz-box-shadow: 0 3px 0 #777; | |
-webkit-box-shadow: 0 3px 0 #777; | |
box-shadow: 0 3px 0 #777; | |
font-size: 1.3em; | |
text-decoration: none; | |
} | |
.lightbox-target { | |
position: fixed; | |
top: -100%; | |
width: 100%; | |
background: rgba(0, 0, 0, 0.7); | |
opacity: 0; | |
-moz-transition: opacity 0.5s ease-in-out; | |
-o-transition: opacity 0.5s ease-in-out; | |
-webkit-transition: opacity 0.5s ease-in-out; | |
transition: opacity 0.5s ease-in-out; | |
overflow: hidden; | |
} | |
.lightbox-target .content { | |
width: 90%; | |
height: 90%; | |
background: #fff; | |
color: #333; | |
margin: auto; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
max-height: 0%; | |
max-width: 0%; | |
border: 3px solid #fff; | |
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
box-sizing: border-box; | |
-moz-transition: ease-in-out 0.5s; | |
-o-transition: ease-in-out 0.5s; | |
-webkit-transition: ease-in-out 0.5s; | |
transition: ease-in-out 0.5s; | |
} | |
.lightbox-target img { | |
margin: auto; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
max-height: 0%; | |
max-width: 0%; | |
border: 3px solid #fff; | |
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); | |
box-sizing: border-box; | |
-moz-transition: ease-in-out 0.5s; | |
-o-transition: ease-in-out 0.5s; | |
-webkit-transition: ease-in-out 0.5s; | |
transition: ease-in-out 0.5s; | |
} | |
.lightbox-target:target { | |
opacity: 1; | |
top: 0; | |
bottom: 0; | |
} | |
.lightbox-target:target .content, .lightbox-target:target img { | |
max-height: 100%; | |
max-width: 100%; | |
} | |
.lightbox-target:target .lightbox-close { | |
top: 5%; | |
} | |
.lightbox-close { | |
display: block; | |
width: 50px; | |
height: 50px; | |
box-sizing: border-box; | |
background: #139dd7; | |
color: #fff; | |
position: absolute; | |
top: 10%; | |
right: 5%; | |
-moz-transition: ease-in-out 0.5s; | |
-o-transition: ease-in-out 0.5s; | |
-webkit-transition: ease-in-out 0.5s; | |
transition: ease-in-out 0.5s; | |
} | |
.lightbox-close:before, .lightbox-close:after { | |
content: " "; | |
display: block; | |
height: 30px; | |
width: 1px; | |
background: #fff; | |
position: absolute; | |
left: 26px; | |
top: 10px; | |
-moz-transform: rotate(45deg); | |
-ms-transform: rotate(45deg); | |
-webkit-transform: rotate(45deg); | |
transform: rotate(45deg); | |
} | |
.lightbox-close:after { | |
-moz-transform: rotate(-45deg); | |
-ms-transform: rotate(-45deg); | |
-webkit-transform: rotate(-45deg); | |
transform: rotate(-45deg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment