- How to create a thumbnail image in CSS
- Overview
- Steps to create a thumbnail image
- 28 CSS Thumbnails
- Related Articles
- Author
- Links
- Made with
- About a code
- Image Gallery with Overlay Effect/Animation
- Author
- Links
- Made with
- About a code
- Card Animation — Demon Slayer
- Author
- Links
- Made with
- About a code
- CSS Image Hover Effects
- Author
- Links
- Made with
- About a code
- CSS Thumbnail Hover Effects
- Author
- Links
- Made with
- About a code
- Respopnsive Images with Thumbnails
- Author
- Links
- Made with
- About a code
- Thumbnail Hover Interaction
- Author
- Links
- Made with
- About a code
- CSS Thumbnail Text Hover
- Author
- Links
- Made with
- About the code
- Split Image Thumbnail
- Author
- Links
- Made with
- About a code
- CSS Thumbnail Transition Effects
- Author
- Links
- Made with
- About the code
- Animated Gallery Thumbnails
- Author
- Links
- Made with
- About the code
- Thumbnail Hover Effects
- Author
- Links
- Made with
- About a code
- Figure & Figcaption
- Author
- Links
- Made with
- About a code
- Fotobook Album Thumbnail
- Author
- Links
- Made with
- About the code
- Document Thumbnail with CSS Custom Property
- Author
- Links
- Made with
- About the code
- Thumbnail Effect
- Author
- Links
- Made with
- About the code
- Thumbnail Hover
- Author
- Links
- Made with
- About the code
- Thumbnail Presentation with CSS Grid
- Author
- Links
- Made with
- About the code
- flex- thumbnails
- Author
- Links
- Made with
- About the code
- CSS Responsive Thumbnail
- Author
- Links
- Made with
- About the code
- CSS Thumbnail
- Author
- Links
- Made with
- About the code
- Flexbox YouTube Thumbnail Grid
- Author
- Links
- Made with
- How TO — Thumbnail
- How To Create a Thumbnail Image
- Example
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
- How to Create Thumbnail Images
- Create HTML
- Add CSS
- Example of creating a thumbnail image:
- Result
- Making the thumbnail image a link
- Example of making the thumbnail image a link opening on a new page:
- Example of making the thumbnail image a link opening on the same page:
How to create a thumbnail image in CSS
Many candidates are rejected or down-leveled in technical interviews due to poor performance in behavioral or cultural fit interviews. Ace your interviews with this free course, where you will practice confidently tackling behavioral interview questions.
Overview
A thumbnail image is the smaller version of an image. When we click a thumbnail image, the full or larger size of the image is displayed. Nowadays, thumbnail images are very commonly used in social media applications and websites.
A thumbnail is characterized by borders which surround it, either to give it a circular, rectangular, or square shape.
Steps to create a thumbnail image
The steps written below describe how we can create a thumbnail image:
- First, we will structure a simple HTML outlay. We can have a simple paragraph saying something about our image, like “click image to see full”, inside the body .
- Then, we will open an tag and structure it like how it’s shown below. The target=»_blank» attribute and value tells the web browser to open the full size image in a new browser window.
- The href value of the image_path is the relative or absolute path to our image. This serves as the link to display the image being called up in the
tag src attribute value.
- We will style our thumbnail image to the little size we want it to be. We can also style the thumbnail to have a circular shape or any other shape we want and to have a nice border around it.
Now, our simple thumbnail image is ready.
Let’s look at the demo code below, which follows the steps listed above.
28 CSS Thumbnails
Collection of free HTML and CSS image thumbnail code examples. Update of July 2020 collection. 3 new items.
Related Articles
Author
Links
Made with
About a code
Image Gallery with Overlay Effect/Animation
This is image gallery with a very easy hover effect/animation using only pure CSS.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Card Animation — Demon Slayer
Card hover animation using CSS and HTML only. It shows the info of characters from anime Demon Slayer.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Image Hover Effects
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Thumbnail Hover Effects
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Respopnsive Images with Thumbnails
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Thumbnail Hover Interaction
Pure CSS thumbnail hover interaction.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Thumbnail Text Hover
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Split Image Thumbnail
Split thumbnail image on hover in HTML and CSS.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Thumbnail Transition Effects
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Animated Gallery Thumbnails
A fancy responsive CSS animated gallery thumbnails.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Thumbnail Hover Effects
Pure CSS3 image thumbnail hover effects, also we can easily change the grid item per row using by Sass variable.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Figure & Figcaption
Design a beautiful and/or unique figure and figcapation pairing.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Fotobook Album Thumbnail
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Document Thumbnail with CSS Custom Property
Dog-ear will position itself it top right corner regardless of original size / aspect ratio of image. Effect achieved by using hidden img to set size of relatively positioned parent container — then two absolutely positioned pseudo elements with the same image as a background overlap to leave dog-ear gap top right. Image url supplied by custom property declared inline in HTML.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Thumbnail Effect
Image thumbnail hover effect.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Thumbnail Hover
CSS thumbnail hover with caption and social buttons.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Dependencies: bootstrap.css, font-awesome.css
Author
Links
Made with
About the code
Thumbnail Presentation with CSS Grid
This should work with older browsers as far as IE9. Older browsers and non-supporting browsers will get a «conservative» design instead.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
flex- thumbnails
CSS flexbox thumbnail arrangements.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
CSS Responsive Thumbnail
CSS Thumbnail responsive flexbox hover transition.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
CSS Thumbnail
Thumbnail CSS hover transition.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Flexbox YouTube Thumbnail Grid
Responsive flexbox unordered list grid of YouTube video thumbnails with Fancybox links. Uses a 9kb image with a 16:9 aspect ratio to be able to use the YouTube thumbnails as a background image, without seeing those black letterbox bars at the top and bottom. This also makes the video thumbnails fluid when resizing the browser.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Dependencies: jquery.fancybox-three.css, jquery.js, jquery.fancybox-three.js
Author
Links
Made with
How TO — Thumbnail
A thumbnail is a small image that represents a larger image (when clicked on), and is often recognized with a border around it:
How To Create a Thumbnail Image
Example
/* Add a hover effect (blue shadow) */
img:hover box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
>
Go to our CSS Images Tutorial to learn more about how to style images.
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
How to Create Thumbnail Images
Thumbnail is a small representation of a large image. This kind of images is mainly used by Websites, which contain many pictures, for making the page download easier and faster. Our snippet will help you to create thumbnail images, including the ones as links.
It’s straightforward, so let’s start to create one together.
Create HTML
img src="https://www.metoffice.gov.uk/binaries/content/gallery/metofficegovuk/hero-images/weather/autumn/autumn-leaves-against-a-blue-sky-photo-andrew-small.jpg" alt="Autumn" width="200">
Add CSS
- Add borders to your image with the help of the border property.
- Use the padding property to create space on all sides of the image.
img < border: 2px solid #C0C0C0; padding: 5px; >
Let’s bring together the parts of our code.
Example of creating a thumbnail image:
html> html> head> title>Title of the document title> style> img < border: 2px solid #C0C0C0; padding: 5px; > style> head> body> img src="https://www.metoffice.gov.uk/binaries/content/gallery/metofficegovuk/hero-images/weather/autumn/autumn-leaves-against-a-blue-sky-photo-andrew-small.jpg" alt="Autumn" width="200"> body> html>
Result
Making the thumbnail image a link
- Use the CSS :hover pseudo-class to select and style the link.
- Put the CSS box-shadow property to implement multiple shadows around the box specifying its color and size.
img:hover < box-shadow: 5px 4px 10px #8B0000; >
Now, we can try some examples.
Example of making the thumbnail image a link opening on a new page:
html> html> head> title>Title of the document title> style> img < border: 2px solid #C0C0C0; padding: 5px; > img:hover < box-shadow: 5px 4px 10px #8B0000; > style> head> body> a target="_blank" href="https://www.metoffice.gov.uk/binaries/content/gallery/metofficegovuk/hero-images/weather/autumn/autumn-leaves-against-a-blue-sky-photo-andrew-small.jpg"> img src="https://www.metoffice.gov.uk/binaries/content/gallery/metofficegovuk/hero-images/weather/autumn/autumn-leaves-against-a-blue-sky-photo-andrew-small.jpg" alt="Autumn" width="200"> a> body> html>
Instead of the _blank value of the target attribute, you can use other values too, which will open the link of the image in different ways.
Example of making the thumbnail image a link opening on the same page:
html> html> head> title>Title of the document title> style> img < border: 2px solid #C0C0C0; padding: 5px; > img:hover < box-shadow: 0px 4px 5px #FFD700; > style> head> body> a target="_self" href="https://www.groovypost.com/wp-content/uploads/2019/07/sunset-beach-phone-photos-featured.jpg"> img src="https://www.groovypost.com/wp-content/uploads/2019/07/sunset-beach-phone-photos-featured.jpg" alt="photo" width="300"> a> body> html>