我直接写了个案例,先看下效果图:
下面是html代码:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>机构动态</title> <style type="text/css"> *{ margin:0px; padding:0px; } .test_m ul { margin: 20px; width: 630px; overflow:hidden; border-top:1px solid black; } .test_m ul li{ padding: 10px 20px 11px 20px; box-sizing: border-box; float: left; width: 315px; height: 111px; list-style: none; } .test_m ul li:nth-child(2n+1){ border:1px solid black; border-top:0; } .test_m ul li:nth-child(2n){ border-bottom:1px solid black; border-right:1px solid black; } </style> </head> <body> <div class="test_m"> <ul> <li> 菜单1 </li> <li> 菜单2 </li> <li> 菜单3 </li> <li> 菜单4 </li> </ul> </div> </body> </html>