* { margin:0; padding:0; } ul li { margin:0; padding:0; list-style:none; } #bg { width:200px; height:200px; position:relative; border:solid 1px #000; } .bai { background:white; width:20px; height:20px; position:absolute; } .hei { background:#000; width:20px; height:20px; position:absolute; }
使用判断奇偶性添加