문제

It seems that margins are not being respected by my block-level elements. I'm unable to solve this issue without converting the block-level elements to inline-block - which I don't want to do - why would I? They should be block :P

Code @ Plunker: http://embed.plnkr.co/oRMieH

Any help would be appreciated.

도움이 되었습니까?

해결책

The answer is that the vertical margins are collapsing. You can read about it, or you can just put double margin-bottom on the top element and forget the margin-top. I only use margin-bottom because when building small screen first, the need for margin-top is very rare for me.

http://css-tricks.com/almanac/properties/m/margin/

다른 팁

It has to do with position: absolute; It creates it's own layer and can't work with margins. You could try position: relative;

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top