Home >Web Front-end >CSS Tutorial >How Can I Make All My Images 100x100 Pixels Using CSS?

How Can I Make All My Images 100x100 Pixels Using CSS?

Susan Sarandon
Susan SarandonOriginal
2024-12-05 15:53:10419browse

How Can I Make All My Images 100x100 Pixels Using CSS?

Displaying Images with Uniform Dimensions Using CSS

Creating an image gallery with a consistent appearance can be challenging when dealing with images of varying dimensions. Here's how to use CSS to make them uniform, specifically targeting a size of 100 x 100 pixels:

Solution:

Implement the following CSS code to achieve your desired result:

img {
    float: left;
    width:  100px;
    height: 100px;
    object-fit: cover;
}

Add this code to your HTML within a