This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29200 - Specifying top and bottom margins in percentage should relate to height, not width, of parent
Summary: Specifying top and bottom margins in percentage should relate to height, not ...
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: Box model (show other bugs)
Version: unspecified
Hardware: All All
: P2 critical
Target Milestone: ---
Assignee: Bert Bos
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-13 16:25 UTC by teo8976
Modified: 2015-10-24 16:29 UTC (History)
1 user (show)

See Also:


Attachments

Description teo8976 2015-10-13 16:25:59 UTC
http://www.w3.org/TR/CSS21/box.html#value-def-margin-width

> <percentage>
> The percentage is calculated with respect to the
> WIDTH of the generated box's containing block. Note that this
> is true for 'MARGIN-TOP' AND 'MARGIN-BOTTOM' AS WELL.

This is completely demential. A vertical margin computed as a percentage of width. Somebody explain me what's the rationale behind that.
Comment 1 francky 2015-10-15 16:06:13 UTC
Well, I don't think it's a bug, nor "completely demential". 
A summary about the rationale you can find on http://www.impressivewebs.com/vertical-percentages-css/#comment-40421.
More about the backgrounds in paragraph 3 (The specs: css2.1 and css3) and paragraph 4 (What I understand of it) of this test page: http://clba.nl/sitepoint/vertical-percentage-margins.htm
Comment 2 teo8976 2015-10-24 16:29:50 UTC
At the very least a way must be provided to express percentages of height.
What is completely unacceptable is that a height (or vertical margin) cannot be expressed, in ANY way, as a percentage of a height.

Actually, this is only a tiny part of a huge problem in the whole CSS specification, that is that EVERYTHING vertical-related is a nightmare.
 
I understand that CSS (and the box model) was conceived with content flowing in a vertical page with a given width but indefinite height in mind, which is the most common scenario, but by 2015 (if not fifteen years ago already) we should have realized that it is not the *only* scenario.

Another example of it is how ridiculously difficult it is to simply center something vertically, actually impossible in a general and elegant way not involving horrible hacks and/or changing the markup and/or only working under given assumptions - where the horizontal counterpart is always trivial.