<!DOCTYPE html><html><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width, initial-scale=1.0"/><metahttp-equiv="X-UA-Compatible"content="ie=edge"/><title>margin 负值</title><styletype="text/css">body{margin:20px;}.float-left{float:left;}.clearfix:after{content:"";display:table;clear:both;}.container{border:1pxsolid#ccc;padding:10px;}.container.item{width:100px;height:100px;}.container.border-blue{border:1pxsolidblue;}.container.border-red{border:1pxsolidred;}</style></head><body><p>用于测试 margin top bottom 的负数情况</p><divclass="container"><divclass="item border-blue">this is item 1</div><divclass="item border-red">this is item 2</div></div><p>用于测试 margin left right 的负数情况</p><divclass="container clearfix"><divclass="item border-blue float-left">this is item 3</div><divclass="item border-red float-left">this is item 4</div></div></body></html>