Should we use flex-grow and flex-shrink instead of media queries?


#1

Question

Should we use flex-grow and flex-shrink instead of media queries?

Answer

When using flexbox for a component(s) on a web page/web app, we should definitely try to make use of these flexbox properties instead of using media queries! Flexbox is responsive by default and flex-grow/flex-shrink may be better to use as there are usually less lines of code to write, specifically when using flex-grow/flex-shrink/flex-basis - as we can use the shorthand flex property in place of these three properties. Unless we need a more specific behavior when our screens are a different width, we should try to use the properties built into flexbox.