Learn how to create a thumbnail image.
A thumbnail is a small image that represents a larger image (when clicked on), and is often recognized with a border around it:
Use an <img> element and wrap an <a> element around it. Style the image with a border and add a 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 a 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 »
Go to our CSS Images Tutorial to learn more about how to style images.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!