Say you wanted to have two form elements side by side, except one of the elements fills the “empty” space.
The text input fills the available horizontal space, and the button sits on the right comfortably; Traditionally, you’d use floats, or
display: inline-block, but in both situations you’d have to manually set the width on both elements.
This is the perfect opportunity to employ a lil’ bit o flex-box.
Starting with some simple markup, we’re going to sprinkle a couple of classes through the markup, pay attention to the
From here, SASS nestings take care of keeping these two classes together, where they make sense:
Boom, form markup and styles, easier than ever. The input and button take up the full width of the parent. No inline-block, no floats, no hard-set widths.
Bonus: Accidental bug hunting