CSS Visual ToolsLesson 74Free preview
CSS Unit Converter
This lesson is part of Web Developer Tools · All levels
Summary
CSS unit converters help understand and convert units such as px, brake, em, percentage, vw, and vh. The relative value depends on the context, for example the size of the root font for brakes or the width of the viewport for vw. Choosing the right unit makes the layout more flexible and accessible.
Key points
- Px is absolute and does not follow user font size preferences
- Brakes are calculated against the font-size of the HTML root element
- Em is calculated against the font-size of the parent element or the element itself
- Vw and vh are respectively 1% of the width and height of the viewport
- The units are relatively better for text and layout that need to adapt
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.