Posted in images
2:54 am, January 12, 2022

center image preview with lightbox and caption

I just wanted a thumbnail or preview of the image, where if clicked it would load into a lightbox, but the preview just shows the center of whatever image is added to it. 

Note: I just picked random images and they are centered, so... /runs


<a href='' class='fancybox'>
  <div class='image-bg'></div>
  <figcaption>Click This Image! (or dont...)</figcaption>

<!-- so now we can just switch the image source, but it needs a new bg class for each, which is annoying, unless we move to ... inline styles -->
<!-- It does make it a bit more messy, but easier to update inline. -->
<a href='' class='fancybox'>
  <div class='image-bg' style="background:url( center no-repeat;"></div>
  <figcaption>Click This Image! (or dont...)</figcaption>


.image-bg {
  	background:url( center no-repeat;
/*  */


<link rel="stylesheet" type="text/css" media="all" href="">
<script src=""></script>


$(document).ready(function() {
          helpers: {
              title : {
                  type : 'float'

View Statistics
This Week
This Month
This Year

No Items Found.

Add Comment
Type in a Nick Name here
Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕


Random Quote
“We ought to take outdoor walks in order that the mind may be strengthened and refreshed by the open air and much breathing.".
Random CSS Property


The :fullscreen CSS pseudo-class matches every element which is currently in fullscreen mode. If multiple elements have been put into fullscreen mode, this selects them all.
:fullscreen css reference