W3C home > Mailing lists > Public > www-style@w3.org > December 2014

Option so line-height only affects height between lines

From: Ben Sciascia <ben.sciascia@sciascia.co.nz>
Date: Mon, 01 Dec 2014 19:49:22 +0000
Message-Id: <7F76BEFC-EC13-40B5-998C-FCA8C48907DA@sciascia.co.nz> (sfid-20141201_194930_026661_D60065C5)
To: www-style@w3.org
Line-height in CSS not only affects the height between lines of text, it also alters the space above and below elements.

This creates a situation similar to the old box model when padding also affected width - changing line-height in CSS can require us to also alter top and bottom margins or padding.



USE-CASE #1: Top edges of headlines need to line-up with top edges of other elements

Because line-height also adds space above the headline, headlines often fail to line up with other elements.

This forces us to compensate with negative margins - and if the line height is changed, the compensating adjustments also requiring updating, creating unnecessary work.



USE-CASE #2: Headlines need to be visually grouped with paragraphs

If the design requires that headlines be visually grouped with paragraphs, less space is required between the headline and paragraph and more space before the paragraph.

But because line-height is also affecting the space between the headline and the paragraph, line-height on larger headlines (like h1s and h2s) create a space thatís too big. 

Reducing line-height reduces the space but it also forces lines in multi-line headlines to bleed together. Adding negative margin to compensate quickly becomes painful if the line-height is adjusted - again, the designer is adjusting multiple properties instead of one.



CONCLUSION:

Overall, this suggestion is about creating an additional line-height property that forces line-height to only affect the height between lines and not the space before and after elements.



Regards,

Ben


___

Ben Sciascia

Sciascia Brothers
Level 1, 56 Brown Street, Ponsonby
PO Box 68-578 Newton,
Auckland, New Zealand

PH: +649 360 0559
FAX: +649 360 0012
MOB: +64 21 44 33 66

www.sciascia.co.nz

ben.sciascia@sciascia.co.nz

WARNING: This e-mail contains information which is CONFIDENTIAL and may be subject to LEGAL PRIVILEGE. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy the e-mail or attachments.  If you have received this message in error, please telephone us immediately and destroy the original message.


Received on Monday, 8 December 2014 17:55:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:49 UTC