While telling someone padding only accepts positive values I realized I can't single out any reasonable technical explanation for it. So I looked it up and this is what I found.
From my point of view, the accepted answer doesn't hold enough water. It's somewhat opinionated and tries to find excuses, rather than reasons for the status-quo (in the sense it's not focused on any problems negative padding values might cause or why browsers would have trouble applying them). I tried to pinpoint it there, but soon realized the question, in current form, won't get me closer to a proper answer. Rather than stalking it, I chose to ask one where I would specifically ask for answers drawing from official and/or credible sources.
What would be so wrong, nonsensical or against core principles of CSS about negative padding values?
Admittedly, this technique is not required often, but when it is, the only way to achieve the effect is by adding an extra wrapper around content, and make use of the wrapper's negative margins. Anyway you look at it, that's sub-par when compared with a potential technique using less markup.
A relatively weak (from my POV) explanation is that padding
is defining the relation between content and background. But background limits can be easily attached to other limits of the box-model, using box-sizing
. I believe padding
ultimately defines a relation between content and border area, and the one between content and background is just resulting from the default relation between border area and background. Why is it we are only allowed to push these border-area limits in one direction but not the other?
Upon digging official documentation, I didn't find any clue on why this decision was made or what was it based upon:
Padding values cannot be negative.
...in CSS Level 1, and
Unlike margin properties, values for padding values cannot be negative.
...in CSS Level 2 (Revision 1) and in Basic-box model.
Notably, one of the issues discussed in Editor's Draft is entitled: "Issue 23 Allow negative padding?".
Does anyone have any idea if it's still under consideration/debate and what arguments are/were tossed?
Edit, based on comment from @MrLister. Here's what type of answers I'm looking for:
- either providing some technical reason on why this would be a bad idea and how it would impair other properties/current implementation of box-model, etc...
- someone who took part in it to step up and say: "Perhaps we rushed it, but this seemed like the proper decision at the time, we didn't think it twice";
Ideally, if the reason(s) why negative padding was not allowed no longer apply, the Spec should change to allow them at some point.
I have to point out I'm not really cut out to be an advocate of causes. In the sense that I know, taken as a hole, my question sounds complain-ish. And that's not what I intended. I'm not really interested in pointing fingers. What I wanted was to know if any show-stoppers are in place, to get other people to consider it (maybe they see something I'm missing) and, if the initial reason(s) no longer apply, to (hopefully) get the issue considered by whoever is in charge of where CSS standards are going today.
I believe negative padding values would be a good addition to the tools of any modern web developer and so far I don't see any major downside to it.