We’re almost done! We just need to style the h2s and the thumbnails. Here, the h2 is styled to
look and behave similarly to the images, with the same hover effects. We add clear: left; to
the h2 to ensure that each new album clears the floated thumbnail of the album that precedes
it:
h2 {
margin: 0 0 5px 0;
font-weight: normal;
font-size: 1.5em;
text-align: left;
clear: left;
}
h2 a:link, h2 a {
display: block;
padding: 0 5px;
border: 1px solid #ccc;
border-top-color: #eee;
border-right-color: #ddd;
border-bottom-color: #bbb;
}
h2 a:hover {
border-color: #ccc;
background-color: #eee;
}
Finally, we’ll style the thumbnails to appear like those in Figure 2.14, which share some
styles with ul.thumbnails.
p.thumb, ul.thumbnails {
margin: 0 0 10px 0;
padding: 0;
float: left;
text-align: center;
background-color: #fff;
line-height: 1em;
list-style: none;
}
p.photo a, p.thumb a, ul.thumbnails a {
display: block;
float: left;
margin: 0;
padding: 4px 4px 9px 4px;
border: 1px solid #ccc;
border-top-color: #eee;
border-right-color: #ddd;
border-bottom-color: #bbb;
background-color: #fff;
text-align: center;
}
p.thumb a, ul.thumbnails a {
width: 80px;
margin-right: 10px;
margin-bottom: 10px;
}
p.photo a:hover, p.thumb a:hover, ul.thumbnails a:hover {
border: 1px solid #ccc;
background-color: #eee;
}
Here’s what the final style sheet should look like; it can be used on all three pages:
gallery.css
body {
margin: 0;
padding: 0;
background-color: #fff;
font: 62.5%/1.75em “Times New Roman", serif;
color: #4d4d4d;
}
a:link, a {
border-bottom:1px dotted #960;
color: #960;
text-decoration: none;
}
a:hover {
border-bottom:1px solid #960;
}
h1 {
margin: 05 6px;
padding: 0 0 .5em 0;
font-style: italic;
font-weight: normal;
font-size: 1.25em;
line-height: 2.375em;
color: #ccc;
}
h1 em {
color: #4d4d4d;
}
h1 a:link, h1 a, h1 a:hover, h1 a em, h1 a:link em,
h1 a:hover em {
border-color: #999;
color: #999;
}
h2 {
margin: 0 0 5px 0;
font-weight: normal;
font-size: 1.5em;
text-align: left;
clear: left;
}
h2 a:link, h2 a {
display: block;
padding: 0 5px;
border: 1px solid #ccc;
border-top-color: #eee;
border-right-color: #ddd;
border-bottom-color: #bbb;
}
h2 a:hover {
border-color: #ccc;
background-color: #eee;
}
p, ul {
margin: 0 6px;
padding: 0;
}
img {
display: block;
margin: 0 auto 5px auto;
border:1px solid #ccc;
border-bottom-color: #eee;
border-left-color: #ddd;
border-top-color: #bbb;
}
br {
display: none;
}
#content {
margin: 0 auto 20px 20px;
padding: 1em 0 0 0;
width: 512px;
background-color: #fff;
font-size: 1.25em;
line-height: 1.75em;
p.photo {
margin: 0 0 10px 0;
float: left;
width: 75%;
text-align: center;
background-color: #fff;
line-height: 1em;
}
ul.navigation {
margin: 0 0 10px 0;
padding: 0;
float: left;
text-align: center;
background-color: #fff;
line-height: 1em;
list-style: none;
position: absolute;
top: 76px;
left: 550px;
}
p.thumb, ul.thumbnails {
margin: 0 0 10px 0;
padding: 0;
float: left;
text-align: center;
background-color: #fff;
line-height: 1em;
list-style: none;
}
ul.thumbnails li, ul.navigation li {
display: inline;
margin: 0;
padding: 0;
}
ul.navigation a {
display: block;
float: left;
margin: 0 10px 10px 0;
padding: 4px 4px 6px 4px;
border: 0;
background-color: #fff;
text-align: center;
width: 80px;
}
p.photo a, p.thumb a, ul.thumbnails a {
display: block;
float: left;
margin: 0;
padding: 4px 4px 9px 4px;
border: 1px solid #ccc;
border-top-color: #eee;
border-right-color: #ddd;
border-bottom-color: #bbb;
background-color: #fff;
text-align: center;
}
p.thumb a, ul.thumbnails a {
width: 80px;
margin-right: 10px;
margin-bottom: 10px;
}
ul.navigation a:hover {
background-color: #eee;
border: 0;
}
p.photo a:hover, p.thumb a:hover, ul.thumbnails a:hover {
border: 1px solid #ccc;
background-color: #eee;
}
p.description {
clear: left;
}
We’ve finished marking up and styling our experimental image page, thumbnails, and
album list, and we have a clean, simple image gallery! At the end of this chapter, in Further
Resources, you’ll find a list of some great examples of online image galleries, along with a
couple of gallery and photo album resources.