Obsessed with React and teaching. I help people become Frontend Developers. Living with my fiancee and Yorkshire Terrier 🐶 in Poland.
Discover Mentorship
Discover Mentorship
The above is an affiliate link, if you buy the book I'll get a small commission at no extra charge to you.
Obsessed with React and teaching. I help people become Frontend Developers. Living with my fiancee and Yorkshire Terrier 🐶 in Poland.
Image by patricia serna from Unsplash
DESCRIPTION
Do you only use pixels or % in CSS? Open yourself to more possibilities and best practices with other available units.
Preview
Relative units
Summary
- Each unit has its own use cases and best practices.
- I love using
rem
as it's a scalable unit and consistent across devices (if proper media queries are set in root HTML element). Also, a lot of duplication is removed as e.g. font is changed in one place. viewport
units can be a good solution for full-page screens and other scenarios where you need to take viewport size into consideration.- Always Check supported browsers on caniuse for the unit you use.
- Read more best practices about CSS units.
THE GUIDE TO BEAT FRONTEND INTERVIEW
slack
Let's build a community that will help each other.