How to make the img in div scale automatically according to the width, but does not affect the scale?

ide%5B%5D=&s_tag=jHDRCb4m" rel=" nofollow noreferrer "> https://www.airbnb.com/s/Oreg.

clipboard.png

Why can the contents of the screen be scaled proportionally and not deformed according to the width of the screen?
the picture is scaled according to scale.
he only plays movies according to scale.
I have checked that it seems to be using flex, but I still can"t figure out how to do it like that!
No matter how wide or narrow it is, at most the text in it wraps or does not wrap.
the picture will shrink and enlarge according to the set width
. How on earth is this done? !
I can"t steal his code even if I want to. . . Want to study how he wrote it!
the whole area zooms in to the lower right


background-size:cover you want a better effect or try to control the size of the picture


I took a look at it. It shows the way the background picture is used. background-size:contain

is set.

if you write with , a similar effect is to set object-fit:contain

with regard to the self-adaptation of pictures, there are generally the following situations

clipboard.png.]

https://www.zhangxinxu.com/st.


if it is mobile, you can take a look at css3's new object-fit, which can maintain the proportion of the image. Like the one above, you can have a picture as a background image, and it can be adaptive according to background


.

Yes, the positive solution upstairs, object-fit is set to contain, can achieve this effect

https://developer.mozilla.org.

Mini Program also has its own attribute called aspectFill

.

https://developers.weixin.qq.

Menu