Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the self-adaptation of picture width by css

Shulou Source: shulou.com Published: 2022-06-01 04:49:24 10月06日 Update

This article mainly introduces css how to achieve self-adaptation of picture width, the article introduces in great detail, has a certain reference value, interested friends must read it!

Adaptive width of picture

How to make a larger picture automatically adapt to the width of a small container? CSS can write as follows:

The code is as follows:

Img {max-width: 100%}

However, IE6 does not support max-width, so when you encounter IE6, use IE conditional comments to rewrite the statement as follows:

The code is as follows:

Img {width: 100%} above are all the contents of the article "how to adapt the width of a picture by css". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Pictures width code content articles larger value interests containers guys buddies more conditions comments knowledge industry sentences information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Docker Linux Redmi NVidia