Is there a way to detect margin-collision and prevent it? like if I have
You do not need to do anything; by the box model specs, adjacent bottom and top margins will collapse, so you get a 10-pixel gap between your two EDIT: the reason why you're not seeing a collapse between a ad a
display: table by default, which is not exactly the same as a block-level element, so by the specs the margins will not collapse.