css float and padding

前端 未结 2 1170
再見小時候
再見小時候 2021-01-03 21:41

This is the HTML layout:

        
...
2条回答
  •  猫巷女王i
    2021-01-03 21:46

    When you float an element, it's effectively taking it out of the document flow, so adding padding to its parent won't have an effect on it. You could use margin-top: 10px; on both of your inner divs.

提交回复
热议问题