CODE
h1 {font-size: 250%; width: 52%; padding-left: 3em; border: solid 1px black;}
h2 {font-size: 150%; width: 52%; padding-left: 3em; border: solid 1px black;}
h3 {font-size: 100%; width: 52%; padding-left: 3em; border: solid 1px black;}
h4 {font-size: 90%; width: 52%; padding-left: 3em; border: solid 1px black;}
The border property is a temporary measure, purely for my own benefit, so that I can see what is going on ... and I cannot understand what is going on???
Each box was a different size (width), even though width was set at 52% for each of them (I thought that would be 52% of the width of the parent container). As the font got smaller, from H1 to H4, so too did the length of the box. The other thing I noticed was that the padding to the left was different for each box - the lines of text did not line up on their left hand side, but were indented to differing degrees. This made me think that perhaps the width attribute might be a function of the font-size.
However, when I substituted 10px for the 3em in the above definitions, and refreshed my screen, suddenly all boxes were of identical length, and all lines were in perfect register ie lined up on their left hand sides.
Why is this so?
Many thanks, James
