Pure CSS lightbox 2

by BinaryAcid

HTML

<div class="thumb">
    <a href="#img-box">
        <img src="https://lh5.googleusercontent.com/-vQQQJODyY3w/T7i9C8ZNMZI/AAAAAAAABA8/O0rJ2JOXk4I/s150/thumb.jpg" alt="" />
</a>
</div>

    <div id="img-wrapper">
    <div id="img-box">
        <a href="#img-wrapper">
            <img src="https://lh3.googleusercontent.com/-32dJfZfMR18/T7i9C4_rkeI/AAAAAAAABA8/ItVJujn0c-8/s500/full.jpg" alt="" /></a>
    </div>
</div>

CSS

div.thumb {
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 5px;
    background: #fafafa;
    margin: 1em 2em;
    max-width: 150px;
}

div.thumb a {
    display: block;
    width: 150px;
    height: 94px;
}

div.thumb a img {
    display: block;
}



#img-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 0px;
    height: 0px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    -moz-transition: all 500mss ease-in;
    -webkit-transition: all 500ms ease-in;
    -o-transition: all 500ms ease-in;
    -ms-transition: all 500ms ease-in;
    transition: all 500ms ease-in;
}

#img-box:target {opacity: 1; width: 100%; height: 100%;}

#img-box img {
    width: 400px;
    height: 250px;
    padding: 25px;
    background: #fff;
    border: 1px solid #ccc;
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -150px 0 0 -225px;
} 

#img-wrapper {
    -moz-transition: all 500mss ease-in;
    -webkit-transition: all 500ms ease-in;
    -o-transition: all 500ms ease-in;
    -ms-transition: all 500ms ease-in;
    transition: all 500ms ease-in;
}

#img-wrapper:target {
    width: 0px;
    height: 0px;
    overflow: hidden;
    opacity: 0;
}