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
Release: 2024-12-05 15:53:10
Original
420 people have browsed it

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;
}
Copy after login

Add this code to your HTML within a