Line spacing..?

  • Thread starter Famine
  • 7 comments
  • 553 views

Famine

GTP Editor, GTPEDIA Author
Administrator
89,016
United Kingdom
Rule 12
GTP_Famine
Have we recently changed line spacing? I seem to recall we went to 1.5 lines with GTP8, but recently everything seems to be just that little bit more compact.


Or is it time for my eye test again?
 
no, you're correct.

Forgive me for this, but:

Edit:
The Line Spacing
Is Fixed


I noticed this when some idiot was posting in size 5 font in the drift forum. Seems the acronym WYSIWYG is not 100% accurate when applied to the new post editor.
 
Boundary Layer
no, you're correct.

Forgive me for this, but:

The Line Spacing
Is Messed Up


I noticed this when some idiot was posting in size 5 font in the drift forum. Seems the acronym WYSIWYG is not 100% accurate when applied to the new post editor.
:lol:

In IE though, the spacing isn't messed up. It only happens in FF here.
 
That's the thing... it isn't restricted to FF...

At home, Layer's text doesn't overlap. At work it does. BOTH computers running the 'fox. But I first noticed the reduction in line spacing on IE at work and it was still the same when I got home and foxed it...
 
Yes, I adjusted the line height slightly a while back, but I forgot about that line-height bug. I can't be bothered to spend a lot of time on it at the moment, but if Sage or someone else know the "quick fix" off the top of their head I would certainly appreciate the help. I probably just need to make the line-height declaration in a unit other than em's.
 
Yup – the easy way to circumvent the problem (it’s actually not a bug ;)) is to specify the line-height in unit-less numbers (e.g.: line-height: 1.5;).

When you specify the line-height with units, the browser calculates the line-height for the parent (usually the body), then applies that same line-height to every child element without re-calculation, even if it’s a relative unit. For example:

HTML:
body { font-size: 14px; line-height: 2em; }
.small { font-size: 10px; }

<body>
    <p>Text</p>
    <p class="small">Small text></p>
</body>

The browser first calculates that 2*14 = 28px, and applies that to the first paragraph, just as you’d expect. You would then expect the browser to make the small text’s line-height 20px, right? (2*10 = 20.) Wrong-o. The browser inherits the calculated value of the line-height, not the specified value – thus, everything in this document will have a line-height of 28px, no matter what the size of the text.

On the other hand, if you do this:

HTML:
body { font-size: 14px; line-height: 2; }
.small { font-size: 10px; }

<body>
    <p>Text</p>
    <p class="small">Small text></p>
</body>

You’ll get what you’d expect – the browser will re-calculate the line-height for each child element.

It’s all specified like this by the W3C for some strange reason.
 
Ah, now I understand...that is a bit confusing! Thanks again for your help, Sage. :)
 

Latest Posts

Back