This box is 300px wide

This box is 50% wide

This box is 50vw wide

This box is 50vh wide

Unit Comparisons: divs

Here we have an illustration of the differences between px, percentages, and viewport units

  • px : static, obviously
  • % : relative to the dimensions¬†of its container
  • vw/vh : relative to the dimensions¬†of the viewport itself