Px unit is fixed in size no matter what screen size you choose. If there's no defined parent then by default body is considered the parent. vw stands for the viewport width which means vw is always relative to the 1% of the width of root, irrespective of parent element's width. vh stands for viewprot height like vw it's also relative to 1% height of root/document.

3m read timeFrom dev.to
Post cover image
Table of contents
px unit% unitem unitrem unitvw unitvh unit
5 Comments

Sort: