The visual design plays a key role in the success of a website, making graphics and images essential elements. One popular method for or­ga­niz­ing multiple images on a site is by using galleries. There are several ways to embed image col­lec­tions: users can, for instance, add a simple lightbox through the source code or use CMS ex­ten­sions.

A lightbox is one of the simplest methods to display images on a website. It is im­ple­ment­ed using dynamic HTML in JavaScript. When users click on thumb­nails, the image opens in a larger format, over­lay­ing the website with a dimmed back­ground. This type of lightbox can be easily in­te­grat­ed into your website and enhanced with ad­di­tion­al features, making it an excellent choice for modern web de­vel­op­ment.

The pre­req­ui­sites are a current version of lightbox and, of course, the images including thumb­nails (preview images), that you want to embed in your site. The first lightbox was developed by Lokesh Dhakar in 2005, and he later released the script under a Creative Commons license. There are now numerous versions and it­er­a­tions of the popular script, which include stand­alone scripts, plugins for JavaScript libraries, or ex­ten­sions for content man­age­ment systems.

Website Builder
From idea to website in record time with AI
  • Intuitive website builder with AI as­sis­tance
  • Create cap­ti­vat­ing images and texts in seconds
  • Domain, SSL and email included

1. Download lightbox

The most well-known lightbox script is available for free download on Lokesh Dhakar’s website. After unpacking the .zip file, you can find the following elements among others: the index.html file in the examples folder, which provides an example, and in the dist directory, the three folders css, images, and js.

2. Embed CSS and JavaScript file

Next, copy the lightbox.css file from the CSS folder into the website’s CSS directory, and the .js file into the JavaScript directory. You will find both of these files in the re­spec­tive folders within the dist directory. Ad­di­tion­al­ly, you must include the following line in the head of the relevant webpage to load the CSS stylesheet:

<link href="your-css-directory/lightbox.css" rel="stylesheet">
html

And the following line must be inserted as the last line before the closing </body> tag to embed the necessary JavaScript:

<script src="your-js-directory/lightbox.js"></script>
html
Note

Lightbox depends on jQuery. If it hasn’t been added yet, jQuery must be included and loaded before using the lightbox script.

Each image you want to display with the lightbox requires a suitable HTML attribute in the source code to provide the script with the necessary in­for­ma­tion. Each link to the image must include the data-lightbox attribute with a unique name for each gallery. Images that are part of the same slideshow should all have the same data-lightbox attribute. To add a caption, use the data-title attribute with the ap­pro­pri­ate text.

Embedding a single image example

<a href="images/image-1.jpg" data-lightbox="bild-1" data-title="image title">
<img src="images/image-1-preview.jpg" alt="alternative description">
</a>
html

Slideshow with multiple images example

<a href="images/image-2.jpg" data-lightbox="show-1" data-title="morning"><img src="images/image-2-preview.jpg" alt="alternative description"></a>
<a href="images/bild-3.jpg" data-lightbox="show-1" data-title="noon"><img src="images/image-3-preview.jpg" alt="alternative description"></a>
<a href="images/bild-4.jpg" data-lightbox="show-1" data-title="evening"><img src="images/image-4-preview.jpg" alt="alternative description"></a>
html

4. Customize lightbox

The lightbox is now in­te­grat­ed into the website. Of course, there are other ways to customize the slideshow or lightbox display. Cus­tomiza­tion is achieved by using the option method after the script is loaded and spec­i­fy­ing the desired values. The function appears as follows:

<script src="your-js-directory/lightbox.js"></script>
<script>
lightbox.option({
'resizeDuration': 200,
'wrapAround': true
});
</script>
html

Overview of the most important options

There are various at­trib­ut­es you can use to adjust the behavior of the lightbox within the option function. Here are the most important ones:

Option Default De­scrip­tion
alwaysShowNavOnTouchDevices false When this option is set to true, the nav­i­ga­tion arrows, which otherwise only appear when hovered over with a mouse, remain per­ma­nent­ly visible on devices with touch screens.
disableScrolling false When set to true, scrolling within the page is no longer possible when the lightbox is open.
fadeDuration 500 This option de­ter­mines how long the overlay takes to fade in or out (time specified in mil­lisec­onds).
maxWidth This option sets the maximum image width (specified in pixels).
maxHeight This option sets the maximum image height (specified in pixels).
positionFromTop 50 This option sets the distance from the top edge of the viewport (specified in pixels).
resizeDuration 700 This setting de­ter­mines the time the container needs for the tran­si­tion between two dif­fer­ent­ly sized images (time specified in mil­lisec­onds).
showImageNumberLabel true If switched to false, the total number of images within the slideshow will no longer be displayed (e.g., Image 3 of 33).
wrapAround false If the option is set to true, the slideshow will start again from the beginning after the last image.

Al­ter­na­tive­ly, there are numerous other programs that can be used to create a custom photo gallery for a website and embed it into your own site. These tools are generally very simple and intuitive to use, often featuring a drag-and-drop editor.

How to implement photo galleries directly in HTML and CSS

Photo galleries can also be im­ple­ment­ed without JavaScript or a lightbox directly with HTML and CSS. The images are usually arranged in a flexible layout (Grid or Flexbox) that au­to­mat­i­cal­ly adapts to different screen sizes. This simple solution is es­pe­cial­ly suitable for fast loading times, re­spon­sive designs, and websites that de­lib­er­ate­ly avoid external scripts.

With just a few lines of CSS, you can create an at­trac­tive and organized photo gallery for a website that is both efficient and SEO-friendly. Here’s an example of a simple photo gallery:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple photo gallery</title>
<style>
body {
margin: 0;
padding: 2rem;
background-color: #f9f9f9;
}
h2 {
text-align: center;
margin-bottom: 1.5rem;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
}
.gallery img {
width: 100%;
height: auto;
border-radius: 8px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.gallery img:hover {
transform: scale(1.03);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<h2>My photo gallery</h2>
<div class="gallery">
<img src="images/image-1.jpg" alt="Sunrise over the ocean">
<img src="images/image-2.jpg" alt="Blooming meadow in spring">
<img src="images/image-3.jpg" alt="Mountain landscape at sunset">
<img src="images/image-4.jpg" alt="City skyline at night">
<img src="images/image-5.jpg" alt="Fall forest trail">
</div>
</body>
</html>
html

In the HTML section of our simple example, an h2 heading and a div container are defined, within which several images are added using the img tag. Each image includes an alt attribute with a brief de­scrip­tion. This is crucial for ac­ces­si­bil­i­ty and SEO. In the CSS section, the grid layout (display: grid) ensures the images are au­to­mat­i­cal­ly arranged in columns that adapt to the screen size. The gap: 10px adds spacing between the images. Hover effects, such as en­large­ment and shadow, enhance the gallery’s in­ter­ac­tiv­i­ty and modern feel when the mouse hovers over an image.

Note

You can easily expand the photo gallery for your website, for example, by adding captions under the photos, applying uniform borders, or using object-fit: cover to display image sections evenly and har­mo­nious­ly. Ad­di­tion­al­ly, you can adjust the layout with a few CSS mod­i­fi­ca­tions to match your corporate design. This way, even without JavaScript, you create a visually appealing, user-friendly, and SEO-optimized photo gallery that can be flexibly embedded into any website.

When im­ple­ment­ing their website, many companies and free­lancers choose to use a content man­age­ment system. This has the advantage of providing a “ready-made framework”—most systems also allow the creation of a pro­fes­sion­al website without deep pro­gram­ming and IT knowledge.

In addition to intuitive operation and user-friendly in­ter­faces, many also ap­pre­ci­ate the flexible structure of systems like Joomla! or Typo3. Thanks to their often-modular design, the framework can be expanded and cus­tomized to suit in­di­vid­ual needs. This is partly due to the large community behind many (open-source) systems, which develops a wide range of ex­ten­sions and plugins. As a result, there are numerous ways to create and integrate pro­fes­sion­al photo galleries. We present a few solutions for the systems Joomla!, WordPress, and TYPO3.

Photo galleries for WordPress

WordPress is the most widely used open-source CMS globally. Although orig­i­nal­ly designed as a blogging platform, WordPress now offers numerous ways to extend and customize, making it a fully-fledged content man­age­ment system suitable for other purposes as well. Es­pe­cial­ly in in­dus­tries like fashion, lifestyle, or beauty, an aesthetic graphic pre­sen­ta­tion is crucial. It’s no surprise, then, that among the over 60,000 ex­ten­sions, there are plenty of plugins available for photo galleries.

NextGen Gallery is one of the most well-known plugins for WordPress. Both thumbnail galleries and slideshows are possible with NextGen, and there is also an in­te­grat­ed lightbox option—all in re­spon­sive design. The plugin offers many options for very large galleries and sim­pli­fies both uploading large numbers of images and image man­age­ment with its clear structure and ease of use. Key pa­ra­me­ters like size, number, or interval are se­lec­table, and adding wa­ter­marks is easy to do. In general, NextGen excels with usability and a clearly struc­tured user interface. The free version of NextGen Gallery is available for download from the WordPress plugin col­lec­tion. On the de­vel­op­ers’ website, you can also find the paid versions, which offer ad­di­tion­al features for pro­fes­sion­al use. These versions provide some in­ter­est­ing functions, es­pe­cial­ly for the e-commerce sector.

The Envira Gallery plugin also allows users to create photo galleries for their website. Users can create in­di­vid­ual galleries for specific posts or pages, as well as global galleries.

The re­spon­sive design is available out-of-the-box with Envira and is im­ple­ment­ed both for galleries and light­box­es. What sets Envira apart is its asyn­chro­nous image loading, ensuring that even with large photo galleries, you don’t have to com­pro­mise on loading time and per­for­mance. As a photo gallery plugin, Envira also offers ad­van­tages from an SEO per­spec­tive, as load speed is an important ranking factor.

The free version of Envira Gallery Lite can be down­loaded from the WordPress Plugin Directory. Paid versions offer ad­di­tion­al features such as wa­ter­marks or video galleries. Learn more about these options on the Envira Gallery website.

MetaSlid­er

The WordPress plugin MetaSlid­er is also among the most popular solutions for pre­sent­ing images and slideshows on a website. With its intuitive drag-and-drop interface, users can create sliders in just a few minutes without any pro­gram­ming knowledge. Users can choose from multiple slider types, allowing them to customize the style, an­i­ma­tions, and tran­si­tion effects in­di­vid­u­al­ly.

A key advantage of MetaSlid­er is its fully re­spon­sive design. All sliders au­to­mat­i­cal­ly adjust to the screen size, ensuring optimal display of images and text on desktops, smart­phones, and tablets. The plugin also offers a variety of SEO options. Ad­di­tion­al­ly, MetaSlid­er is com­pat­i­ble with the WordPress Block Editor (Gutenberg) and popular page builders, making it easy to integrate into existing layouts. The free version of MetaSlid­er is available in the official WordPress Plugin Directory. For more features, users can upgrade to the Pro version, which includes video sliders and thumbnail nav­i­ga­tion.

Photo galleries for Joomla!

Even Joomla! is gaining in­creas­ing pop­u­lar­i­ty, both in the United States and in­ter­na­tion­al­ly. It is con­sis­tent­ly ranked among the most widely used content man­age­ment systems. Joomla! also provides users with a vast community and a large selection of ex­ten­sions and plugins.

sigplus

The Simple Image Gallery Plus—ab­bre­vi­at­ed as sigplus—es­sen­tial­ly delivers what its name promises, sup­port­ing users in creating simple photo galleries. This light­weight plugin for photo galleries serves its purpose well and is par­tic­u­lar­ly suitable for small websites and galleries with a man­age­able number of images. In­ex­pe­ri­enced users benefit from its ease of use and intuitive operation. In “Advanced Mode,” ex­pe­ri­enced users can access ad­di­tion­al settings for thumb­nails, caching, and more. The plugin is free and available for download in the Joomla! Ex­ten­sions Directory.

Phoca Gallery is also free and offers a sig­nif­i­cant­ly broader range of functions compared to the pre­vi­ous­ly mentioned sigplus. It allows you to embed photo galleries and slideshows into your Joomla! website. However, operating Phoca Gallery is not as intuitive—beginners, in par­tic­u­lar, will need some time to fa­mil­iar­ize them­selves in order to fully utilize its features. Once you’re up and running, you’ll have access to basic functions as well as useful features like watermark in­te­gra­tion and a download option for visitors. The free extension can be found on the Joomla! website, and on the developer’s page, where you can find detailed doc­u­men­ta­tion along with ad­di­tion­al modules and plugins for Phoca Gallery.

The paid Joomla! plugin Showtime Image Gallery allows for the simple creation of pro­fes­sion­al photo galleries directly within the content man­age­ment system. Users can create galleries for in­di­vid­ual posts or pages and embed them via modules or short­codes. With support for popular lightbox scripts like FancyBox, Light­Gallery, or Pho­to­Swipe, images can be presented in an appealing and in­ter­ac­tive large format. Thanks to the re­spon­sive design, all galleries au­to­mat­i­cal­ly adjust to different screen sizes. Ad­di­tion­al­ly, users can assign SEO-relevant at­trib­ut­es such as image titles and alt texts to improve vis­i­bil­i­ty in search engines. The plugin is available for download as a sub­scrip­tion model on the Fire­coders developer studio website.

Photo Galleries for TYPO3

TYPO3 is also a popular content man­age­ment system. The CMS is a highly ex­ten­si­ble software used for both small to medium-sized websites and large en­ter­prise solutions. As a result, the TYPO3 community is vast. However, TYPO3 is not the easiest solution if you want to create a website without much prior knowledge. Nev­er­the­less, many companies invest time in fa­mil­iar­iza­tion or hire pro­fes­sion­al staff to fully leverage the benefits of the CMS. When it comes to photo galleries for websites, TYPO3 offers several pro­fes­sion­al solutions.

The TYPO3 extension Simple Image Gallery or bm_image_gallery allows for the simple creation of flexible and re­spon­sive photo galleries for websites. Users can create galleries directly from TYPO3 file col­lec­tions, enabling cen­tral­ized image man­age­ment and reuse in multiple galleries. Clicking on an image op­tion­al­ly opens a lightbox, dis­play­ing the image in large format and allowing intuitive nav­i­ga­tion through the gallery. With support for custom image sizes and Ty­po­Script con­fig­u­ra­tions, the display and layout of galleries can be adjusted to meet specific re­quire­ments. The extension is also SEO-friendly, as alt texts, titles, and de­scrip­tions can be added for each image. bm_image_gallery can be in­te­grat­ed into modern TYPO3 in­stal­la­tions and is available for download in the Ex­ten­sions Store of TYPO3.

ns_gallery

The TYPO3 extension ns_gallery is a paid solution for creating pro­fes­sion­al photo galleries for websites and mul­ti­me­dia sliders. It supports various layouts, slider displays, and zoom functions, allowing galleries to be visually adaptable to your web design. ns_gallery allows for managing images in albums and cat­e­gories and also supports embedding videos, such as from YouTube.

With features like lazy loading and re­spon­sive design, both loading times and display on mobile devices are optimized. The extension also offers extensive lightbox functions. It can be tested for free for 15 days and is then available as an annual sub­scrip­tion or a lifetime sub­scrip­tion on the official website.

Create a website with your domain
Build your own website or online store, fast
  • Pro­fes­sion­al templates
  • Intuitive cus­tomiz­able design
  • Free domain, SSL, and email address

SEO-relevant aspects of photo galleries

Photo galleries for websites can sig­nif­i­cant­ly enhance your site’s vis­i­bil­i­ty in search engines if they are properly optimized. This includes using de­scrip­tive file names, alt texts, and image de­scrip­tions that help search engines un­der­stand the image content. Ad­di­tion­al­ly, a re­spon­sive display, fast loading times through lazy loading, and optimized image sizes con­tribute to per­for­mance, pos­i­tive­ly affecting your ranking.

SEO checklist for galleries

Provide all images with de­scrip­tive file names

Add alt texts and titles for image de­scrip­tions

Optimize images for fast loading times (com­pres­sion, lazy loading)

Embed re­spon­sive sizes for various devices

Use struc­tured data

If possible, add captions or subtitles

Use internal linking to relevant content

Reviewer

Go to Main Menu