4 ms·
> Why do you think the padding as a percentage is relative to the width of the parent The serious answer is: 1. Many early web engines used `display: content-
by nicoburns 10mo ago
> Why do you think the padding as a percentage is relative to the width of the parent
The serious answer is:
1. Many early web engines used `display: content-box`. So the padding was actually considered to be outside of the box itself.
2. Early web engines were strict about height-can-depend-on-width, but width-cannot-depend-on-height to avoid circular dependencies.
- throwawayffffas 10mo agoWhile that's true. They could have gone another way without breaking the dependency rules. Padding top and bottom could be relative to parent height and padding left and right could be relative to parent width. They would not be the same. But it would still make sense. It would arguably be more logical than the selected behavior. But the specific example does not even invalidate my point there is a whole website about css quirky behaviors and how to use them to your advantage, https://css-tricks.com/ https://css-tricks.com/.
- Izkata 10mo ago> 1. Many early web engines used `display: content-box`. So the padding was actually considered to be outside of the box itself. IIRC this was actually the spec, and IE decided to ignore it and do something saner, while the box-sizing attribute to pick what you wanted came later. Designing for content-box and IE displaying using border-box (or whatever it did) was one of the reasons it got the nickname "internet exploder" - everything ended up positioned or sized wrong. Until box-sizing came along, it was common to use various hacks / bugs in the browsers' CSS parsers to make certain rules only apply to certain browsers to fix this.
- nicoburns 10mo ago> IIRC this was actually the spec, and IE decided to ignore it and do something saner That's actually a little unfair on IE. This behaviour predates there even being a spec. IE and Netscape did it differently, and as a general rule Netscape's behaviour tended to be what ended up in the spec. This was mostly a good thing, but not so much in this case.