Add padding without changing overall width

后端 未结 4 1028
一整个雨季
一整个雨季 2021-01-04 03:05

How can I add padding to an element without adding on top of the predefined width?

It\'s good to define the width of a column to make a clean grid for the layout; bu

4条回答
  •  余生分开走
    2021-01-04 03:44

    It's an old thread, I know. But last time I had a complete black hole about making a DIV with a NOT set width and with paddings, so it will not blow up my 3-columns row and with CSS2. So I put one DIV with float left, on with right and between them a DIV with no float and no fixed width, but I wanted to have padding in it. How about that...

    I gived up. :D But I put an inner DIV in the center one and give it width=90%. So far so good, a very simple and not great solution, but sometimes it helps to achieve the look you need. ;]

    b.r.

提交回复
热议问题