css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv
CodePen probably won't work great in this browser. We generally only support the major desktop browsers like Chrome, Firefox, Safari, and Edge. Use this one at your own risk! If you're looking to test things, try looking at Pens/Projects in Debug View.
user profile image

A simple Lightbox made without JavaScript. It simply works with :focus pseudo-class on the trigger element.

Note 1: I used background-image because once coupled with display: none on its parent, it doesn't load image on page load.

Note 2: I didn't use flexbox for the image placement because of weird effects on responsive resize.

Comments

  1. Not too bad. Safari doesn't like you though. Here's my take from a while back, using a similar technique. Instead of :focus, I used :target. http://codepen.io/designcouch/pen/DEkcf

  2. @designcouch > Yes, I already tried this technique, but I wanted to create an easy example of lightbox without JavaScript, even if the "lazy load" technique complexify the thing :-/ Also note that I tried to fix this f*****g issue on Safari iOS (and others browsers :/), but unfortunately even the Bootstrap teem didn't succeed, for now → https://github.com/twbs/bootstrap/issues/15935

Leave a Comment Markdown supported. Click @usernames to add to comment.

You must be logged in to comment.
Loading...
Loading...