the vw (View Width) and vh (View Height) units are great for screen based sizing in CSS.

They are used like this:

img {
  width:100vw;
}

where percentages are changing the size based on a percentage of selected item’s parent, viewport units are a fractional ratio of the viewport (think: screen minus the UI elements).
So 1vw is 1/100th of the width of the viewport.

some nice reference:



8 Likes