How to make the image change size with the screen in css

藏色散人
Release: 2023-01-04 09:36:37
Original
8188 people have browsed it

CSS method to make the image change size with the screen: 1. Use the "width height auto" attribute to scale the image; 2. Use the "max-width max-height" attribute to set the maximum width and height.

How to make the image change size with the screen in css

The operating environment of this tutorial: windows7 system, css3 version, Dell G3 computer.

Recommended: "css Video Tutorial"

Sometimes we want the image to scale with the screen size, two situations:

  • Single picture scaling

  • Picture scaling within the box

Nude picture scaling

  timg.jpeg 
Copy after login

How to make the image change size with the screen in css

The picture is in a box

  
timg.jpeg 下面的文字
Copy after login

How to make the image change size with the screen in css

ps:

1. Use width height auto to zoom

2. Use max-width max-height to set the maximum width and height. 100% means the original maximum.

The above is the detailed content of How to make the image change size with the screen in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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 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!