一大盒子平均分为三个盒子
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>一大盒子平均分为三个盒子</title> <style> html, body { color:#222; font-family:Microsoft YaHei; margin:0; padding: 0; text-decoration: none; } body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td { margin:0; padding:0; } img { border:0; } ol, ul,li{ list-style: none; margin:0; padding: 0; text-decoration: none} a { color:#000000; text-decoration: none; } .mainmenu:after { clear: both; content: " "; display: block; } .mainmenu li{ float:left;margin-left: 2.5%; width: 30%; border-radius:3px; overflow:hidden;} .mainmenu li a{ display:block; color:#FFF; text-align:center } .mainmenu li a b{ display:block; height:80px;} .mainmenu li a img{ margin: 15px auto 15px; width: 50px; height: 50px;} .mainmenu li:nth-child(8n+1) {background-color:#36A1DB} .mainmenu li:nth-child(8n+2) {background-color:#678ce1} .mainmenu li:nth-child(8n+3) {background-color:#8c67df} </style> </head> <body> <div class="mainmenu"> <li><a href="/" ><b><img src="http://images.cnblogs.com/cnblogs_com/heyiming/947284/t_1.jpg" /></b></a></li> <li><a href="/" ><b><img src="http://images.cnblogs.com/cnblogs_com/heyiming/947284/t_2.jpg" /></b></a></li> <li><a href="/" ><b><img src="http://images.cnblogs.com/cnblogs_com/heyiming/947284/t_3.jpg" /></b></a></li> </div> </body> </html>
效果图: