Using flexbox to make responsive widgets without media queries.
With one fixed width column (unless its on its own row) [in
dark blue
].
Allows for widget layout where parts of the widget have minimum widths and
when…:
-
…we don't know
the placement of the widget on a page: whether the widget would be in a main column or a side column
-
…we don't know
the width of the viewport, ever.
-
…we don't know
which pre-existing media queries exist
Various width containers
Example use case
Flexbox responsive sign up widget. No media queries
If anything is unclear, leave me a comment :)
Get changing that browser window width already
Pros
-
No media queries
-
Items can be set to wrap when they reach their minimum width.
Cons
-
Predicting exactly when [viewport width] something will wrap is tricky (math!). E.g. when something wraps, you also want a different text size (this is a P.I.T.A. to achieve without media queries to orchestrate changes to properties other than width).
Container 100% width
Container 80% width
Container 60% width
Container 40% width
Container 20% width
Nesting the HTML