How can I detect if elements are displayed in a row, or if there's a line break and then apply additional styling?
In this case both buttons fit in one row:
<div style="width: 200px">
<button>small</button>
<button>small</button>
</div>
In this case they display above each other:
<div style="width: 200px">
<button>very very very long element</button>
<button>small</button>
</div>
And in this case I'd like to automagically add margin-bottom: 16px
to the first button (or margin-top
to the second one - doesn't matter).