that's because you've taken div out of the "main flow." you've likely floated other elements effectively taking them out of the main flow. thus, now that you want to position the div with margins it's not taking. that's why adding the float works, it places it in the new flow model ...
–
alexfreiriaMay 24 '13 at 13:36

It will work with the first code you posted, so there must be other CSS applying.
–
ralph.mMay 24 '13 at 13:38

I think Xander is right. Follow the fiddle: jsfiddle.net/Qnea2 — its working! I have the same on my code and without success. (Ok, I think its not the same, but my code is so big and I couldn't found the "x question" of the problem.)
–
Guilherme OderdengeMay 24 '13 at 13:41

4 Answers
4

This is occurring because you've taken div out of the "normal flow." You've likely floated other elements, effectively taking them out of the main flow. Now that you want to position the div with margins it's not relative to the elements that have been taken out of the normal flow. That's why adding the float works, it places it into a new flow.

"A floated box is positioned within the normal flow, then taken out of
the flow and shifted to the left or right as far as possible. Content
may flow along the side of a float. [...] When a box is taken out of
normal flow, all content that is still within normal flow will ignore
it completely and not make space for it."

That's gonna depend a lot on your layout. Showing some html or URL would help. But, as Christian said, setting up the position would help. You might also try with position:relative; or also, instead of margin, try padding-bottom:25px;