Public Voice Network
- Art of the Day Thread 324324
- Align shortcode Divs?
- Technological Eye Strain 99
- Pic of the Day 7478274782
- PHP Help 11
- Old Mac Pro G5 99
- London machete attack 6363
- Looking to source IA... 11
- FMT170513 1818
- Cape Cod 99
- the gif animation thread 1848818488
- Vid of the Day 1507715077
- this style of photography… 1010
- Been asked to do a legal … 2020
- Official NSFW Thread 260260
- DaftPunk 213213
- I ❤ Wood 335335
- ☮ WTF 44
- What are you listening to… 55915591
- Game of the Day 1414
- Flat Design 162162
- New BOC 3030
- Dickson Poon 2020
- Chick of the Day 1825418254
% 66 Responses
Last post: 10 months, 1 week ago | Thread started: Jul 19, 12, 7:41 p.m.
- BabySnakes
10% of the elements parent set height. and should be the same cross browser.

- Dog-earJul 19, 12, 7:51 p.m. – Permalink
- IRNlun6
It's based on context.
On an h2 with a base font size of 16px (1em), and a line-height of 18px (1.125em); setting a 10% top margin is equal to 10% of 16px or 1.6px. I prefer setting the margin on a base line-height to help in managing the vertical rhythm. So 18px top margin / 16px base font size = 1.125em.
If you have a div with no set height, then the context is the total of all borders, margins, paddings, font size, line-height, total line numbers, etc... of children in parent. If you have a set height size for container then the height of the container is the context.
10% of 64px height container = 6.4px


- Dog-earJul 19, 12, 8:19 p.m. – Permalink
- qoob
OK, I figured it out. Strangely enough, turns out it uses the WIDTH of the parent element to calculate margin-top and margin-bottom when set as a percentage:
http://www.w3.org/TR/CSS2/box.ht…
Totally nonsensical, sometimes I question whoever it is that comes up with this stuff :P


- Dog-earJul 19, 12, 8:38 p.m. – Permalink


