5 ms·
Where the traditional box model starts to make sense is with fixed-size elements, such as images. Adding padding to an element shouldn't alter the dimensions of
by robgibbons 15y ago
Where the traditional box model starts to make sense is with fixed-size elements, such as images. Adding padding to an element shouldn't alter the dimensions of the contents within the element.
- kilburn 15y agoYes it should. If you don't want that space to be from within the element, then you should be setting a margin, not a padding. Box analogy: when you add foam padding to a box to protect its content, are you effectively widening the box or reducing the volume it can fit?
- robgibbons 15y agoUsing your analogy, if I have to transport an item, and I want to pad it sufficiently, I should be looking for a bigger box. Not trying to shrink the item.
- deleted 15y ago[deleted]
- funkah 15y agoGood point. Maybe the best thing then is to add a rule for "img" or maybe ".fixed-size" with "box-sizing: content-box" right after after the "*" rule.