.fm-bubbles { display: flex; flex-wrap: wrap; width: 100%; height: 100px; } .fm-bubble { flex: 1 1 10%; height: max-content; border: 1px solid royalblue; border-radius: 5px; }
<div class="fm-content"> <div class="fm-bubbles"> <p class="fm-bubble">Lorem, ipsum.</p> <p class="fm-bubble">lorem</p> <p class="fm-bubble">adsadad</p> <p class="fm-bubble">sss</p> <p class="fm-bubble">asdasda asdasda</p> <p class="fm-bubble">asss</p> <p class="fm-bubble">sss</p> <p class="fm-bubble">asdas asd</p> <p class="fm-bubble">adadaddd</p> <p class="fm-bubble">adadasd</p> <p class="fm-bubble">addd</p> <p class="fm-bubble">adadd</p> <p class="fm-bubble">ss</p> </div>
Currently my boxes only touch horizontally, but I would also like them to touch vertically. I tried searching for information on this, but when I did find something that worked, it gave them more height than they needed.
p
The tag has amargin
attribute by default. Setmargin: 0
to fix vertical spacing.EDIT: This does not create a masonry layout, just removes the space between the boxes.
Edit 2
you can:
To parent
fm-bubbles
. This will make the child maintain the height of its content and eliminate vertical space between children.