Different padding when div floats vs when it's full width

If you change the #container's width to 99px, the blue div will float under the red div because the width is too small.

Is it possible to add a padding or margin so that there is a space between the red and blue divs when the blue div is underneath the red div AND ensure that the top and bottom space (paddding) between the container and the div's remain equal (they are 10px now)?

And if the #container is set back to 100px, both red and blue divs line up perfectly top/bottom?

http://jsfiddle.net/86F2A/49/


Maybe add margin-bottom to both containers and don't use padding-bottom on the main container.

http://jsfiddle.net/86F2A/52/

链接地址: http://www.djcxy.com/p/89256.html

上一篇: 块增加了不可控制的垂直边距

下一篇: 不同的填充当div浮动与全宽时