0
What is the difference between pixel and percentage?
How we change pixel into percentage? Like 1% mean 1pixel or 120 = to 1%?
1 Réponse
+ 3
• % is relative unit of measurement in css (divide the total width or hight of screen in 100 parts and a single part will be 1%)
• px is absolute ( every device may have different pixel of width and height)
You can use javascript to cheque how much pixel does 1 percent of screen contain.
to get it use the code
var width = window.innerWidth;
console.log(width/100)