Preview a YouTube thumbnail at feed size with CSS
When a creator tool displays a thumbnail in a card, the exported 16:9 image is usually much larger than the preview. Text that looks fine in the editor can disappear at a card width of 160 or 320 pixels. I use two previe
When a creator tool displays a thumbnail in a card, the exported 16:9 image is usually much larger than the preview. Text that looks fine in the editor can disappear at a card width of 160 or 320 pixels. I use two preview sizes and a consistent crop before choosing a layout.
<div class="thumbnail"><img src="thumbnail.jpg" alt="Preview of the thumbnail"></div>
.thumbnail {
width: min(100%, 320px);
aspect-ratio: 16 / 9;
}
.thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
display: block;
}
Change the width to 160px for the second view. If the preview cuts off a face or heading, compare object-position: 35% center with the centred version. A CSS crop only affects the preview. Export the chosen crop as an image before uploading so the result matches the preview wherever it is displayed.
For a source image I already have, I use StopScrollβs free YouTube thumbnail resizer for that last step. I work on StopScroll. The CSS above works with any image.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.