Current: https://i.sstatic.net/e7V8x.png Desired: https://i.sstatic.net/Xszod.png
Is it possible to achieve this using the flex or grid model, or do I need to reconsider the structure with a different approach?
Below is the code snippet:
.sections {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
margin: 0em -1em 2em -1em;
}
.box {
position: relative;
display: inline-block;
flex-grow: 0;
min-width: 300px;
max-width: 420px;
margin: 1em;
border-radius: 10px;
padding: 1em;
vertical-align: top;
}
.elements {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
margin: 1em 0em 0em 0em;
}
.itm {
position: relative;
display: inline-block;
flex-grow: 0;
width: 100px;
margin: 1em;
text-align: center;
border-radius: 10px;
box-shadow: 0px 5px 8px 2px rgb(0 0 0 / 20%);
padding: 0.5em;
vertical-align: top;
}
<div class="section">
<div class="box">
<p>Long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text </p>
<div class="elements">
<div class="itm">
<p>asdf asdf</p>
</div>
<div class="itm">
<p>asdf asdf</p>
</div>
<div class="itm">
<p>asdf asdf</p>
</div>
</div>
</div>
<div class="box">
<p>Medium text medium text medium text medium text medium text medium text medium text medium text medium text medium text medium text </p>
<div class="elements">
<div class="itm">
<p>asdf asdf</p>
</div>
<div class="itm">
<p>asdf asdff</p>
</div>
<div class="itm">
<p>adsf adsf</p>
</div>
</div>
</div>
<div class="box">
<p>Short text short text </p>
<div class="elements">
<div class="itm">
<p>asdf asdf</p>
</div>
<div class="itm">:
<p>asdf asdf</p>
</div>
<div class="itm">
<p>sadf sadf</p>
</div>
</div>
</div>
</div>