How to create: thumbnails

Learn how to create thumbnails.

Thumbnails

Thumbnails are small images representing larger images (clickable), usually identified by the border around them:

Tulip

How to create thumbnails

Use the <img> element and wrap it with an <a> element. Set image style with borders and add hover effect:

<style>
img {
  border: 1px solid #ddd; /* Gray border */
  border-radius: 4px;  /* Rounded border */
  padding: 5px; /* Some padding */
  width: 150px; /* Set a small width */
}
/* Add hover effect (blue shadow) */
img:hover {
  box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
}
</style>
<body>
<a target="_blank" href="img_forest.jpg">
  <img src="img_forest.jpg" alt="Forest">
</a>
</body>

Try it yourself

Related pages

Tutorial:CSS image