With flex layout, can the width after the row be the same as above?

bVYrp1?w=713&h=160

flex

EF

clipboard.png

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            /*li*/
            -sharpnav
            {
                /*width: 80%;*/
                margin: 0 auto;
                border: 2px solid -sharp00CED1;
            }
            ul,li /*ul limargin padding */
            {
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            ul /**/
            {
                display: flex;
                flex-direction: row;
                flex-wrap: wrap;

            }
            li
            {
                border: 1px solid;
                width: 300px; /**/
                text-align: center;
                margin-top: 10px;
                margin-bottom: 10px;
                flex:auto;  /**/            
            }
        </style>
    </head>
    <body>
        <div id="nav">
            <ul>
                <li>AAAA</li>
                <li>BBBB</li>
                <li>CCCC</li>
                <li>DDDD</li>
                <li>EEEE</li>
                <li>FFFF</li>
            </ul>
        </div>
    </body>
</html>
May.26,2021

if the lattice is of fixed width, set a width for the lattice. The parent
display: flex;
flex-wrap: wrap;
the width of line wrapping is the same


I can't think of a perfect way to check the screen size, use different percentages on different screens, and stop grow. The code is as follows. I hope it suits your situation:

  

flex is an one-dimensional layout.
2D layout, it is recommended to use grid

Menu