Please tell me how the Flex layout automatically adapts the box size to child elements that exceed the width of the screen.

the example is here: https://codepen.io/mashirozx/...

page uses column wrap layout, want to constantly load new content, and in the form of child elements append into the box, beyond the width of the screen can scroll (overflow-x), so the width of the box can be automatically adjusted according to the width of the child elements, similar to the traditional layout of width: auto .

this is the current situation:

:

how should I adjust it?

Jun.09,2022

add overflow: auto;


to the flex box

if you need to keep the outer margin of the 10px at the end (rightmost), you can add:

to the answer upstairs.
.flex-container-content > div:last-child {
  border-right: 10px solid -sharp333;
}

the calculation of the width of the parent container is extremely complex here, and the conclusion is that according to the visual formatting model, the right margin will be ignored. If you are interested, please take a look at the standard explanation: https://www.w3.org/TR/CSS22/visudet.html-sharpblockwidth


both of you upstairs are done, that's what happened

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bcf5ce-131b2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bcf5ce-131b2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?