Lightbox without JavaScript


When we tours the shopping websites, the products pictures sometimes show as normal size.  If we wanna look up the detail large pictures, the better convient way is to click. Here I monitor the gallary called Lightbox without JavaScript and the code is clear and simple.



HTML contains the small picture with a link to the large picture. The large picture classed lightbox can be click. 



CSS is clear for the main elements. Becauuse of the same picture, I set the max-width to resize the image,such as 20% of small picture and 80% of large picture.  The lightbox firstly should be hide with display:none.  z-index is larger than the small picture 0. The background is responsive with browser size for 100% fixed.  

When users target the lightbox, the large picture show up and hide. Moreover, I notice there is a default blue outline in Chrome browser,so the outline sets to none. 

Full code in my Codepen Here




Popular posts from this blog

Fancyapps — easily build overlay windows with carousel

Meet Tippy.js: The Complete Tooltip Popover Plugin

Meet Mantine: A TS-Based Open-Source React Components Library