VW / VH vs % vs PX ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

VW / VH vs % vs PX ?

Which one of these is best for a responsive website (or maybe for a WebApp like facebook).. With VW does it mean i dont need @media to resize for different smartphone width again? Thanks.

15th Feb 2019, 6:52 AM
Lawz
Lawz - avatar
5 Answers
+ 5
I assume you already understand what these are. 1. Media query is still needed when you want to position the containers in different way, Example: https://code.sololearn.com/W02pmd87hzEz/?ref=app (rotate mobile to see) 2. You need to use all of them, for different elements. vw vh is usually for the container of the sections. % for the container of the elements px for font size of body in media query em for font size in each element. Example: https://code.sololearn.com/W3gS00IGw160/?ref=app
15th Feb 2019, 6:59 AM
Gordon
Gordon - avatar
+ 3
Yes that is because I want to to demo font size can be based on screen size too in that tutorial. And later I added some maximum to font size by using px at CSS line 112 to line 122
15th Feb 2019, 7:06 AM
Gordon
Gordon - avatar
+ 3
Gordon After going through your tutorial, i finally understood page responsive.. Thanks..
15th Feb 2019, 7:52 AM
Lawz
Lawz - avatar
+ 3
Lawz You are welcome ^^ I am going to code a second responsive design tutorial using display: grid and display: flex. I will share with you when I finish.
15th Feb 2019, 9:23 AM
Gordon
Gordon - avatar
+ 2
Gordon But i can use vw for font size to, its responsive to different mobile..
15th Feb 2019, 7:02 AM
Lawz
Lawz - avatar