Answer the question
In order to leave comments, you need to log in
How to calculate margins as a percentage?
Good day!
I have a 960px wide layout with 10px side padding to convert these margins to percentages I divide by 10px/940px*100 but the margins are 14px and the blocks don't match the layout. Everywhere it is written that it is necessary to calculate exactly this way. Who can tell what is the problem?
Answer the question
In order to leave comments, you need to log in
960px = 100%
1px =100/960= 0.10416%
And now we calculate:
940px = 0.10416%*940px=97.916%
10px = 0.10416%*10px = 1.0416%
jsfiddle.net/jnrt7v12
Do you want to know the padding width in %?
960 -> 100%
10 -> x
x*960 = 10*100
x= 10/960*100
Two for you :-P
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question