CSS - images and divs exhibit different behavior-PHP Chinese Network Q&A
CSS - images and divs exhibit different behavior
P粉512729862
P粉512729862 2023-09-12 19:58:47
0
1
531

.d1 { border: 1px solid black; display: flex; width: 300px; height: 300px; }

Why does the image also stretch to the end of the flexbox width? Shouldn't it only extend towards the bottom, like thedivelement does inside the Flexbox container?

P粉512729862
P粉512729862

reply all (1)
P粉459440991

You can control the maximum width and maximum height of the image to easily solve your problem.

Just use CSS to addmax-widthandmax-heightto the image and then add your own values there.

    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!