Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Using width % with em padding Reply To: Using width % with em padding

#192081
Tom
Participant

I’m not that great with em’s myself but I can give you the basic math for the example in your pen. Here goes, max-width: 1000px = 62.5em because 1000px/16px = 62.5 so since you sized the container div to 75% you do 62.5em*0.75 = 46,875em and since you used padding: 1em you do 46,875em - 2em = 44.875em so width: 44.875em; is the answer. Pay attention however the padding isn’t the same for both divs. A base 1em is 16px and 1.6% of the div is 12px since 750px*0.016 = 12px. I hope this helps!