+ 1
Which is the best way to set the size of text on CSS and why? em, rem, px, %, vw or vh? Thank you, people!
3 ответов
+ 1
Understanding what they all do is important. For a beginner, I recommend having your main font-size in px and setting heading levels in em to keep things simple. After that, I think it's a matter of preference. (There are some pretty fierce champions of different setups. Search: "62.5% rule" for some entertainment.) If you're using a library that you didn't create, you'll need to understand the units the library uses (e.g. dp in React).
I hope this helps! ☺
+ 10
it depends on user screen display.. but i use px most of time😅
+ 5
For responsive design, it's best to use rem, but rem has compatibility issues with older version browsers. The best dimension to use now is em.
Use % or vw for making screen width proportion.
Use vh for screen height proportion.