Animal Photography Lab (Lab 12)
Related Lessons
This is Lab 12 in Web Fundamentals (CSCI1450). Before you start this lab, be sure you have studied the Module 12 slideshow.
This lab assumes that you have a website template to use as a starting point, with the Bootstrap and Font Awesome frameworks already added. If you need a template, see the Template Lab. If you need the frameworks for Bootstrap and Font Awesome, see the beginning of Lab 11.
Jump to:
- A. Set Up the Project
- B. Prepare Your Images (Images 1-2-3)
- C. Create the Hero Row
- D. Icon and Text Row
- E. JavaScript onClick Photo Gallery
- F. Design the Footer
- G. Customize with CSS
- Example Websites
- Grading Checklist
For this lab, you are building a website for a client who wants to display her best animal photographs. Your assignment is to create the home page for her new website, choosing your own CSS styles. The website features a JavaScript photo gallery.
Here’s an example of what a finished product could look like. Your web page will be different, with your own fonts, colors and CSS:

A. Set Up the Project
Step 1. Set Up Project Files
- Copy (or duplicate) your template folder.
- Rename the new folder to “animals”. Make sure the folder is in your “websites” folder.
- Add a folder for the website images.

Step 2. Change the Width of the main Selector
In style.css, find your existing main selector, and change the width to 1200px.
Step 3. Create a Text Header
In the header, delete the existing <h1> tag. Replace it with a <div> that has a class of site-title, containing the text “Animal Photography”. Best practice is to save the <h1> tag for the name of each individual page, not the site name — that’s why we use a <div> here instead:
<div class="site-title">Animal Photography</div>
Step 4. Update the Nav Links
This lab doesn’t have separate About or Contact pages. Change those nav links to href="#" so they don’t lead to a broken page.
B. Prepare Your Images (Images 1-2-3)
In this next set of steps you will prepare the images for the Animal Photography website using Images 1-2-3. If you need a refresher on how to crop and resize images for your computer, refer back to the Module 12 slideshow. We’ll make the hero 1200 x 400 pixels and the images for the gallery 800 x 600 pixels.

Step 1. Download the Images
Download the images zip file: Photography Website Images
Step 2. Create the Hero Image
The hero will be exactly 1200 x 400 pixels (3:1 aspect ratio). Look through the images and pick out your favorite animal photo for the hero. Use the Image Prep for Website Use tool to crop, resize, and optimize the hero image in one step — or use a different tool if you prefer. (Note: This crop can be difficult to do, because on most of the images it is necessary to crop out part of the animal.)
Having Trouble with the Hero? It is a requirement for this lab to crop one image to 1200 x 400 pixels for the hero. If you are having problems, here are some things to try:
- Focus on the part of the image that is the most important for your crop.
- Some of the animal images are harder to crop than others. Try a different photo.
Step 3. Crop and Resize the Gallery Photos
The gallery photos will be 800 x 600 pixels (4:3 aspect ratio). Pick out any 5 (or more) animal photos you’d like to use for the photo gallery. Use the same tool to crop, resize, and optimize those photos. You can delete or set aside whichever photos you don’t use.
Step 4. Rename the Image Files
Rename each of the image files you cropped so they are easier to reference in your code.
Step 5. Image Folder
Last, but not least, move the cropped, resized, optimized, and renamed images into the “images” folder inside of the “animals” folder.

C. Create the Hero Row
Now we will place the hero image inside of the <main> section inside of a Bootstrap column. When there is only one column, use col-sm-12. It is important to use Bootstrap even if there is only one column, because Bootstrap adds padding and margin. (If you skip the grid for a single column, you will not have good alignment.)
Step 1. Set up the Bootstrap Column
We will place the hero image inside of a col-sm-12 column. Copy this code into the <main> section of the web page to get started:
<main>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<!--Content goes here for a single column-->
</div>
</div>
</div>
</main>
Step 2. Insert Embedded Hero Image
For this lab, we will use an embedded image for the hero instead of a background image. You can read more about the choice of background or embedded hero images in the Two Ways to Create a Hero Image lesson.
Add an embedded image for the hero. Here is the <img> code with the image classes you will need:
<img class="hero-image img-fluid" src="" alt="" height="" width="">
- Set the src to your hero image.
- Add alt text to describe the image.
- Set the image height to 400
- Set the width to 1200.
Note: on the code above I included the hero-image class so that you can use it to style the hero. In addition, I included img-fluid class. Apply this Bootstrap class to all images because it adds a max-width.
D. Icon and Text Row
The Icon and Text row will be a combination of icons and text. Here are a couple of examples of icon and text rows. The first example uses col-md-2 plus col-md-10. The second example uses col-md-2 plus col-md-8 plus col-md-2.

Step 1. Start the New Row
Start a new row with <div class="row">.
Step 2. Add Bootstrap Columns and Insert Text
Write the Bootstrap code for your icon and text columns.
Here is the text:
The website features photographs of animals from Pixabay.com. The key to animal photography is patience. It can take a long time to get the right lighting and the best view of the animal. When photographing animals, you do not have a lot of control...you need to wait for them.
Step 3. Add Icons
Go to Font Awesome 4 to browse the icons, or use our Font Awesome 4 Icons tool to search and copy the code.
Icons are tiny by default, so you’ll need to style them with CSS — at minimum, increase the font-size. Select them in your CSS using the .fa class; for this row specifically, main .fa works well, since it only targets icons inside your <main> section and won’t affect icons you add elsewhere later, like in the footer. See the Font Awesome Icons lesson for more ways to style them.
E. JavaScript onClick Photo Gallery
In the third row we will place the JavaScript photo gallery. In the steps below I provide you with all of the JavaScript code for it. You only need to insert your images and alt text.
Clicking on a thumbnail photo is an onclick event that switches the main photo. You can also see it live here: https://jsfiddle.net/smetoxen/9d4jrr3n/. Here is a screenshot of it:

Step 1. Add the Bootstrap Row and Column
The third row in the main section is the JavaScript photo gallery. We will place it in col-md-12, because it is full width.
- Close the row for the icon and text row with a closing
</div>and create a new row with<div class="row">. - Add
<div class="col-sm-12">to start the new single column in the new row. - Indent your code and check to make sure that all the
<div>tags you have opened have been closed.
Step 2. Add the HTML and CSS for the Gallery
This is the HTML code for the gallery:
<div class="gallery">
<!-- Big preview image. Starts out matching the first thumbnail below. -->
<div class="preview">
<img id="preview" src="https://webdevstudents.com/wp-content/uploads/2026/11/lab12-gallery-demo-photo2.jpg" alt="Rocky coastline with waves" height="600" width="800"/>
</div>
<!-- Clickable thumbnails. Clicking one swaps the preview image above. -->
<div class="gallery-thumbnails">
<img onclick="document.getElementById('preview').src = document.getElementById('img1').src; document.getElementById('preview').alt = document.getElementById('img1').alt;" id="img1" src="https://webdevstudents.com/wp-content/uploads/2026/11/lab12-gallery-demo-photo2.jpg" alt="Rocky coastline with waves" />
<img onclick="document.getElementById('preview').src = document.getElementById('img2').src; document.getElementById('preview').alt = document.getElementById('img2').alt;" id="img2" src="https://webdevstudents.com/wp-content/uploads/2026/11/lab12-gallery-demo-photo3.jpg" alt="Red lighthouse on a pier" />
<img onclick="document.getElementById('preview').src = document.getElementById('img3').src; document.getElementById('preview').alt = document.getElementById('img3').alt;" id="img3" src="https://webdevstudents.com/wp-content/uploads/2026/11/lab12-gallery-demo-photo4.jpg" alt="Niagara Falls from above" />
<img onclick="document.getElementById('preview').src = document.getElementById('img4').src; document.getElementById('preview').alt = document.getElementById('img4').alt;" id="img4" src="https://webdevstudents.com/wp-content/uploads/2026/11/lab12-gallery-demo-photo8.jpg" alt="Desert rock formation under blue sky" />
<img onclick="document.getElementById('preview').src = document.getElementById('img5').src; document.getElementById('preview').alt = document.getElementById('img5').alt;" id="img5" src="https://webdevstudents.com/wp-content/uploads/2026/11/lab12-gallery-demo-photo10.jpg" alt="Grand Canyon overlook" />
</div>
</div>
This is the CSS for the gallery. Copy this code into the style.css and place it above the media queries.
/* CSS for the JavaScript photo gallery */
.gallery .preview{
width: 100%;
height: auto;
}
.gallery .gallery-thumbnails {
margin: 0 auto;
text-align: center;
}
.gallery .gallery-thumbnails img {
width: 100px;
height: 75px;
margin: 3px 10px 10px 0;
}
.gallery .gallery-thumbnails img:hover {
opacity: 0.8;
cursor: pointer;
}
.gallery .preview img#preview {
padding: 1px;
max-width: 100%;
height: auto;
margin: 0 auto !important;
display: block !important;
}
Notice there is no separate JavaScript panel — the gallery works using onclick attributes built right into the HTML, so there’s nothing extra to copy into a script.
Check your gallery to make sure it works before proceeding. It is a fully functioning gallery with placeholder images that you will replace.
Step 3. Replace the Images and Alt text
After you make sure the gallery is working, change the images and alt text in the HTML to the images for the animals photo gallery.
Here’s the first thumbnail’s tag, broken down piece by piece:
onclick="..."andid="..."make the gallery work — leave them alone.- For each thumbnail, replace
src="..."with the path to one of your own 800 x 600 photos, and updatealt="..."to describe that specific photo. - Set that same
srcandalton the#previewimage too, so the preview starts out matching the first thumbnail. - Use at least 5 images total, each with its own accurate alt text — no empty
alt="", and no reusing the same alt text twice.
Test out your gallery in the browser to make sure every image and thumbnail works correctly.
F. Design the Footer
Now that we have finished the <main> section, we will design the footer for the website. In the example below there is a double footer, with key information in the upper footer, and the copyright information in the lower footer. This is a common design on modern websites.

Step 1. Make the Footer Full-Width
It’s important to keep the <footer> tag itself full-width for its background color. If you add a max-width directly to your <footer> tag’s selector, the background color will only fill part of the page instead of stretching edge to edge.
To fix this:
- Insert a
<div>tag inside your<footer>tag, around the container-fluid<div>and everything inside it. A good name for the class is “inner-footer”, i.e.<div class="inner-footer">, but you can name the class anything you would like. - Apply the same
max-width: 1200px;andmargin: 0 auto;trick you used for your<main>section to this new wrapper<div>, not to the<footer>tag itself.
With this approach, the <footer> tag itself stays full width, so its background color fills the entire page. The new wrapper <div> inside it keeps your footer content centered at a readable 1200px width.
Step 2. Create the Bootstrap Columns.
Start by copying the Bootstrap code at the beginning of the <main> section into the beginning of the <footer> section — starting with the container-fluid div, placed inside the wrapper div you just added in Step 1. Remember that for two columns you would use <div class="col-sm-6"> two times.
Step 3. Add Text to First Column
Here is some sample text for the footer:
Web Design Exercise
I created this Animal Photography web page as a lab assignment in my HTML Fundamentals course. The images are royalty-free photos from pixabay.com. JavaScript was used to make the photo gallery, and Bootstrap columns for responsive layout.
Step 4. Add Icons and Text to Second Column
In the second column, add icons with text, similar to the screenshot above. Suggested icons: LinkedIn, GitHub, and Email.
Go to Font Awesome 4 to browse the icons, or use our Font Awesome 4 Icons tool to search and copy the code.
G. Customize with CSS
Now this is where you make the design your own, choosing colors and fonts that fit a photography website. This applies to the whole website, not just the footer. If you need ideas, jump down to the Example Websites section to see the designs of other students.
Step 1. Choose Google Fonts
Go to Google Fonts and choose fonts for this website. Since we don’t have a logo, you may want to choose a display font for the header text. If you need a refresher, read about Google Fonts here.
Step 2. Choose Colors
Choose colors for this website. Apply your color choices to the headings, the header or nav, and the footer. Need help picking colors? Try the Simple Hexadecimal Color Picker or CSS Color Name Picker. You can also try the Color Picker: Choose from Image tool to pick colors directly from one of your animal photos, so your website matches.
Step 3. Design the Images
Use CSS to add at least two properties to decorate your website images. It’s important to use a consistent design across all of your images — the same border, box-shadow, border-radius, etc. — rather than styling each one differently. Choose from the following properties:
border(remember it needs the three border properties). Need a refresher? See the CSS Borders lesson, or try the Border Generator for the code.border-radius(in px). Need a refresher? See the CSS Border Radius lesson.box-shadow. Need a refresher? See the CSS Box Shadows lesson, or try the Box-Shadow Generator for the code.
To select your images in CSS, don’t use the bare img tag — it’s too generic and will affect every image on the page. Instead, use one of these more specific selectors:
.hero-image— selects the hero image..preview img— selects the gallery’s large preview image..gallery-thumbnails img— selects the gallery thumbnails.
Step 4. More CSS Properties to Try
Here are some other CSS properties you may want to use to finish your design:
- background-color
- color (text-color)
- font-size
- text-shadow, try the Text-Shadow Generator
- padding and margin, to manage spacing
- text-align (center, left, right)
Example Websites
Here are some Animal Photography websites made by students:



Grading Checklist
Here is a checklist of what I will be looking for when grading the website:
Now you know how to build a JavaScript photo gallery and crop, resize, and optimize your images! Move on to Lab 13 to start designing your final project.
Need Help?
Using AI for coding is not allowed in this course, so if you get stuck simply Make an Appointment for office hours. In addition, if you run into a bug as you are working, you may email your websites folder to me at susan.metoxen@saintpaul.edu.
