设置margin-top值时,溢出到父元素

给子元素margin-top时,若这个子元素前面没有其他内容,这个margin-top值会应用到父元素上

解决方案,给父元素设置:before

body:before{
		    content: "";
		    display: table;
		    /*或者display: inline-block;*/
		  }


原文地址:https://www.cnblogs.com/Zting00/p/7497690.html