lolo
lolo

Reputation: 71

css flex wrap with fixed_width & centered on page & left justified elements

this is NOT a duplicate question because I need the elements to be divs

I would like container to have a max-width of 800px I would like there to be no spaces & each box be 250px & centered & wrapped (justify left)

    |-  centered -|
--->[box][box][box]<---
--->[box][box]     <---

or

      |-center-|
----->[box][box]<-----
----->[box][box]<-----
----->[box]     <-----

or

-------->[box]<--------
-------->[box]<--------
-------->[box]<--------
-------->[box]<--------
-------->[box]<--------

so far I have

#container {
    display: flex;
    flex-wrap: wrap;
    max-width: 800px;
    align-content: flex-start;
    justify-content: center;
}
#container > .box {
    position: relative;
    width: 250px;
    height: 300px;
    border: red solid thick;
}
<div id="container">
    <div class="box">a</div>
    <div class="box">b</div>
    <div class="box">c</div>
    <div class="box">d</div>
    <div class="box">e</div>
</div>

which centers the leftover boxes on the last row (i would like them LEFT justified).

the other similar questions don't use div elements and I need these to be divs (not li or ul)

Upvotes: -4

Views: 29

Answers (0)

Related Questions