Why does CSS not support negative padding?

前端 未结 7 1447
予麋鹿
予麋鹿 2020-11-30 01:26

I have seen this many a times that the prospect of a negative padding might help the development of CSS of certain page elements become better and easier. Yet, there is no p

7条回答
  •  难免孤独
    2020-11-30 01:56

    I recently answered a different question where I discussed why the box model is the way it is.

    There are specific reasons for each part of the box model. Padding is meant to extend the background beyond its contents. If you need to shrink the background of the container, you should make the parent container the correct size and give the child element some negative margins. In this case the content is not being padded, it's overflowing.

提交回复
热议问题