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

Proposal: easy attribute to uncollapse margins

From: Jonas Thiem <jonasthiem@googlemail.com>
Date: Sat, 18 Oct 2014 21:36:04 +0200
Message-ID: <CAD7Z2hoLrAfXoJsS6askLXJkhHnx8CVicUUoYzNZT2jsxsD8Zg@mail.gmail.com>
To: www-style@w3.org
Hi people responsible for CSS,

Sometimes collapsed margins are undesirable on elements with no
borders and padding, e.g. for the body element if you want to do exact
height calculations (for example to have its minimum height match the
viewport height) without the first child or last child's margins
throwing your calculations off.

The internet has come with nightmare'ish hacks to work around this:



The shortest and most readable solution I have found is still this
one: margin: -1px 0 0 0; border-top: 1px solid;

However, this is still a hack. The obvious question is: can't you add
a simple uncollapse-margin:uncollapse; style property or something
along the lines to the CSS specs?

Sorry if this is already in the specs, but I couldn't find something
along the lines on the internet and I'm not a regular CSS proposal
person, so I don't know all of the specs in full detail. Also sorry if
this mail has gone to the entirely wrong place, this seemed like the
correct list to mail this to.

Jonas Thiem
Received on Monday, 20 October 2014 20:36:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:25 UTC