Can I Resize an Image Proportionally Using Only CSS?

Mary-Kate Olsen
Release: 2024-10-30 01:56:29
Original
791 people have browsed it

Can I Resize an Image Proportionally Using Only CSS?

Resizing an Image Proportionally with CSS

Query:

Can I resize an image to a percentage of its own size using only CSS?

Answer:

Yes, you can resize an image proportionally with CSS using the following methods:

Method 1: Visual Resizing

This method resizes the image visually, but not its actual dimensions in the DOM. The resized image will be centered within its original size.

img {
  transform: scale(0.5);
}
Copy after login

The above is the detailed content of Can I Resize an Image Proportionally Using Only CSS?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!