Today I’m going to show you how to use HTML and a little CSS to create a basic image gallery for your blog’s sidebar. This is a versatile layout that you can use for sidebar navigation, blogrolls, or just to show off your favorite images.
In this beginner-level tutorial, I’ll take you through the steps for creating a two-column sidebar gallery with six 100px square images. Each image link to a different page. At the end of the post, I’ve included some CSS styling options to customize the gallery.
What You Need To Use This Tutorial
- The option to add custom HTML widgets/gadgets to your sidebar. Blogger, self-hosted WordPress, and Typepad Unlimited users, you’re all set. WordPress.com users will need the premium Custom CSS option to use CSS.
- Images for your sidebar. In this tutorial I’m using 100px square images. If you have a wide or narrow sidebar, you may need to adjust the image sizes. Keep in mind that the gallery looks best when all of the images are the same size.
You don’t need any previous experience with HTML or CSS to use this tutorial, I’ll walk you through it.
All set? Let’s get started!
Upload Your Images
If you use Blogger, you can upload your images to your Picasa Web Album for your blog. If you’re on self-hosted WordPress, upload your images to your media library. Typepad users can upload images to the File Manager. No matter what platform you’re on, if you prefer to use Photobucket or another image hosting service, you can!
After you’ve uploaded your images, you’re ready to start writing the HTML for the gallery.
The HTML
Here’s the skeleton template for a 6 image gallery:
I’ve created an editable version of this template on Codepen. You can open the editor in a new tab to code along with the tutorial. When you use Codepen to write your HTML, you’ll see a preview of how your gallery will look before you add it to your blog. This is nice since you don’t have to worry about making a mess on your blog while you experiment!
If you’d prefer to write your HTML “offline”, make sure you have a suitable text editor — Notepad is built-in on PCs, TextEdit is built-in on Macs (you’ll need to set it up for use as an HTML editor first). Never edit HTML with a word processing program.
Let me take you through the HTML and explain what each part means.





Comments