A photo gallery is a page for browsing a collection of pictures. A practical single-page gallery shows small versions first; clicking one displays a larger photo without leaving the page. section 10.1 section 10.3
Build the page around four parts:
- A header with a logo and site title. section 10.1
- A main area with a gallery title, viewing instructions, and photo thumbnails. Each photo can have alternative text and a caption. section 10.6
- A lightbox overlay that shows the large photo when its thumbnail is clicked and closes when the visitor clicks the page. section 10.3
- A footer with a copyright notice. section 10.1
Make a separate thumbnail copy of each original photo before building the page. Large photo files add up quickly, especially for visitors on slow connections or limited mobile data. For a nine-photo gallery, thumbnails around 300 pixels wide work well. Keep filenames paired—for example, image01-thumbnail.jpg and image01.jpg—so the lightbox can show the matching original. section 10.2.3 section 10.3
A starter request for ChatGPT
“Create HTML for a photo gallery with a logo and title, viewing instructions, nine captioned thumbnails, and a copyright footer. Put the CSS in styles.css and the JavaScript in script.js. Use Flexbox to center the gallery images and let them wrap. When a thumbnail is clicked, show its matching full-size image in a lightbox overlay; clicking the page should close it.” Add your own image filenames, alternative text, captions, fonts, and colors. If the response includes only the first image, ask for the complete HTML with every image specified. section 10.5 section 10.6 section 10.3
Flexbox keeps the thumbnails from running in one long vertical column: centered items can wrap to fit the browser window. Check that the saved HTML links to styles.css and script.js, then try clicking a thumbnail and closing the overlay. To customize the result, change captions and alternative text without removing their surrounding HTML tags or quotation marks. section 10.5 section 10.6 section 10.8
