Lightbox
Use the lightbox element to display images or videos inside a full-screen modal window.
The lightbox element shows images (with or without captions) or videos inside a fullscreen slideshow modal window. Lightboxes are also responsive across breakpoints, making them useful for displaying media on desktop, tablet, and mobile screens.
How to create a lightbox
A lightbox is a clickable thumbnail nested in a link block. When site visitors click inside the link’s boundaries on the live site, the lightbox opens to display the media connected to it. You can add a lightbox from Add panel > Advanced.
How the lightbox placeholder thumbnail image works
The lightbox contains an image element which behaves like any other image element. You can resize it, double-click to replace the placeholder thumbnail image, and add alt text. Learn more about image elements.
You can use the same image for the lightbox thumbnail and the larger lightbox modal window. Webflow automatically creates responsive variants for all inline images. Learn more about responsive images.
How to replace the lightbox thumbnail with other content
You replace the placeholder image element and drag and drop other content (e.g., a heading, or any other non-link elements) inside the lightbox link.
You can also use a div block and apply a background image to create equal-sized image thumbnails.
How to style the lightbox
You can style both the lightbox link and its content. For example, if you nest text elements in your lightbox link, you can style the lightbox link element's typography.
You can’t customize the background overlay in the modal window that opens when you click on the lightbox link. However, you can add an image or video and add an image caption if you want.
How to add lightbox media
To add an image and caption to the lightbox modal window:
- Select the lightbox link on the canvas
- Go to Element settings panel > Lightbox link settings > Media
- Click the “Add list item” icon
- Choose "Image" as the Type
- Click Replace image
- Select an image from the Assets panel
- Add a Caption if needed
You can add as many images to a lightbox link as you want. These images will be displayed as a slideshow inside the lightbox modal window.
Note: Currently, lightbox elements don’t support alt text for images within the lightbox.
To add a video to the lightbox modal window:
- Select the lightbox link on the canvas
- Go to Element settings panel > Lightbox link settings > Media
- Click the “Add list item” icon
- Choose "Video" as the Type
- Add the video’s URL to the URL field
- Add a Title if needed
How to create dynamic lightboxes from Collection field media
You can create dynamic lightboxes by pulling the thumbnail image and/or lightbox media from media Collection fields (i.e., an image field, multi-image field, or video field) in your CMS or Ecommerce Collections.
To connect a dynamic Collection field to the lightbox thumbnail:
- Add a lightbox to a dynamically-connected Collection list or a CMS Collection page
- Select the placeholder thumbnail image
- Go to Element settings > Image settings
- Click the "purple dot" icon in the Image field
- Select an image Collection field
Then, you can connect the lightbox to the Collection field, so your dynamic Collection images are available in the lightbox. To connect a dynamic Collection field to the lightbox media:
- Select the lightbox link
- Go to Element settings > Lightbox link settings
- Click the "purple dot" icon in the Media field
- Select a media Collection field
To connect a lightbox to a multi-image field:
- Add a Collection list to a Collection page
- Connect the Collection list to the multi-image field by clicking the Source dropdown and selecting the multi-image field
- Add a lightbox to the Collection list
- Select the image element in the lightbox
- Go to Element settings > Image settings
- Click the "purple dot" icon in the Image field
- Select the multi-image field
- Select the lightbox link on the canvas
- Go to Element settings > Lightbox link settings
- Click the "purple dot" icon in the Media field
- Select the multi-image field
You can also connect a lightbox to a multi-image field when the lightbox is added to Collection lists or Collection pages.
How to link lightboxes using lightbox groups
You can link multiple lightboxes together to create a slideshow gallery. When a site visitor clicks a linked lightbox, the lightbox will open all the media associated with the linked group.
How to create a lightbox group
- Select any element in a lightbox
- Go to Element settings > Lightbox settings
- Enter a group name in the Match or create a group name field
Lightboxes using the same group name are linked in a group.
For lightboxes in Collection lists, creating and linking one lightbox in a Collection item automatically links all lightboxes in the Collection list.
Create multiple lightbox groups on a page
If there are multiple lightboxes on the same page, you can separate them by assigning each lightbox group a different Group name.