CSS之盒子通栏写法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>盒子通栏写法</title> <style> *{ margin: 0; padding: 0; } .top, .banner, .main, .footer{ margin: auto; } .top{ height: 80px; background-color: red; } .top-son{ width: 900px; height: 80px; background-color: aquamarine; margin: auto; } .banner{ width: 900px; height: 150px; background-color: blue; } .banner li{ float: left; width: 217px; height: 150px; margin-right: 10px; list-style: none; } .one{ background-color: blueviolet; } .three{ background-color: cadetblue; } .two{ background-color: bisque; } li.four{ background-color: brown; margin-right: 0; float: right; } .main{ width: 900px; height: 500px; background-color: #eeeeee; } .left{ width: 300px; height: 500px; float: left; background-color: coral; } .right{ width: 600px; height: 500px; float: left; background-color: cornflowerblue; } .footer{ width: 900px; height: 100px; background-color: black; } </style> </head> <body> <div class="top"> <div class="top-son" ></div> </div> <div class="banner"> <ul> <li class="one">1</li> <li class="two">2</li> <li class="three">3</li> <li class="four">4</li> </ul> </div> <div class="main"> <div class="left"></div> <div class="right"></div> </div> <div class="footer">footer</div> </body> </html>