Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

margin-top in a nested div

Tags:

html

css

margin

I have a problem with the margin-top in a nested div -- when I apply margin-top to the nested div, the margin is applied to the parent div instead of the nested div.

Any ideas?

like image 325
JuanPablo Avatar asked May 23 '10 01:05

JuanPablo


2 Answers

I get the solution with overflow:auto in the parent div.

like image 168
JuanPablo Avatar answered Oct 04 '22 06:10

JuanPablo


Margins will collapse by design. Add 1px of padding as well and it should work fine.

like image 35
edl Avatar answered Oct 04 '22 05:10

edl