MEPX
Chapter 4 of 10All chapters

Chapter 4 of 10

Layout

Flexbox, grid and responsive design.

Two systems

Flexbox arranges items in one direction and is right for rows of controls. Grid arranges in two directions and is right for page layout. Most designs use both.

  • gap spaces children without margins on each one.
  • minmax and auto-fill make a grid respond without any media queries.

Responsive

Design for the small screen first and add layout as space allows. Relative units and max-width on images prevent the horizontal scrollbar that ruins phones.