+ 4

What is the difference between vh and px and percent

Help

6th Mar 2019, 10:39 PM
Kouwe Kots
Kouwe Kots - avatar
3 Answers
+ 10
1vh is equal to 1% of the viewport's height, with the viewport being the browser window. 1px is one physical pixel on the device's screen. Percent is the relative size compared to its parent element. For example, a div with 50% width inside another div will take up half of the outer div's width. Vh and percent are both relative units, so they scale based on some factor of the device it is viewed on. Pixels are absolute, so a 100x100 pixel image will be larger on a low resolution screen, but very small on a screen with high pixel density.
6th Mar 2019, 11:28 PM
Austin
+ 2
So what is different between view port and percent 😹
8th Mar 2019, 1:18 PM
yossef Dawoad
yossef Dawoad - avatar