PDA

View Full Version : Margins don't collapse/combine?



brandon_tran
19 Feb 2015, 6:33 PM
Hi guys, I have a container with components in them and have margins set for the components. The components margins seem to add on top of eachother intead of collapsing.

For instance, if I have a container with bottom margin of 10px and a container below that with a top margin of 15px, the combined distance between the two containers is 25px's. Normal CSS dictates that only the largest margin should be used (in this case 15px).

What's going on?

joel.watson
28 Feb 2015, 10:54 AM
Hi--

Are the components floating or absolutely positioned?

Thanks
Joel

brandon_tran
2 Mar 2015, 10:14 AM
Hi Joel, thanks for replying but I figured it out. It was because the outer div element for the container was set to inline and not block.

joel.watson
2 Mar 2015, 1:47 PM
Awesome, glad you figured it out!

Thanks
Joel