In this tutorial I will show you how to create a cool looking, killer photogallery using the latest coding techniques.
We will use the new HTML5 language, CSS3 and jQuery cross-browser JavaScript library.
You can check how it will look like by visiting the demo gallery,
click here to see the demo.
This tutorial only shows the front end.
Step 1
First let's create the base of our HTML document:
Code:
<!DOCTYPE html>
<html>
<head>
<title>Photogallery Demo - HTML5, CSS3, jQuery</title>
<meta charset="utf-8">
</head>
<body>
<!-- ... -->
</body>
</html>
As you can see, with the new HTML the Doctype thingy became more friendly and easier, and with the help of the new meta declaration it's really easy to determine the charset of our site.
Let's create the body of our document:
Code:
<body>
<div id="pagewrap">
<header>
<!-- HEADER -->
</header>
<section id="content">
<!-- MAIN CONTENT -->
</section>
<footer>
<!-- FOOTER -->
</footer>
</div>
</body>
The page will consists of 3 parts, a header, the main content and the footer.
We have a lot more tags at our disposal with HTML5 now, so our code will look more clear and coherent.
For now the header will only have an <h1> tag with the name of the gallery.
Code:
<header>
<h1>NAME of YOUR GALLERY</h1>
</header>
The main stuff comes within the section
Code:
<section id="content">
<ul id="filter"> </ul>
<div class="clear"> </div>
<ul id="photos"> </ul>
<div class="clear"> </div>
</section>
Filter will have the filter links and the photos obviously the images.
Code:
<ul id="filter">
<li><a href="#all">All</a></li>
<li><a href="#europe">Europe</a></li>
<li><a href="#africa">Africa</a></li>
<li><a href="#usa">United States</a></li>
</ul>
The 'photos' will have a little bit more content:
Code:
<ul id="photos">
<li>
<a rel="gal" class="gallery" href="images/europe1.jpg">
<img src="images/europe1_thumb.jpg" alt="Europe 1" title="Europe 1" />
</a>
<span class="help">europe</span>
<div class="mask"> </div>
</li>
<li>
<a rel="gal" class="gallery" href="images/usa1.jpg">
<img src="images/usa1_thumb.jpg" alt="USA 1" title="USA 1" />
</a>
<span class="help">usa</span>
<div class="mask"> </div>
</li>
<!-- etc... -->
</ul>
What we have here is a thumbnail with a link that points to the larger image. The 'rel' and 'class' attribute will be used by the fancybox image viewer.
Our footer has only the copyright info:
Code:
<footer>
©Gallery 2011.
</footer>