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

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

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

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


posted @ 2016-08-12 10:03  ning0_o  阅读(626)  评论(0编辑  收藏  举报