CSS之盒子左右布局
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>盒子左右布局案例</title> <style> .top, .banner, .main, .footer{ width: 900px; border: 1px dashed #cccccc; margin: auto; } .top{ height: 80px; background-color: red; } .banner{ height: 120px; margin: 5px auto 0; background-color: blue; } .main{ height: 500px; margin: 5px auto; background-color: #eeeeee; } .left{ width: 300px; height: 500px; float: left; background-color: coral; } .right{ width: 600px; height: 500px; float: left; background-color: cornflowerblue; } .footer{ height: 100px; background-color: black; } </style> </head> <body> <div class="top"></div> <div class="banner"></div> <div class="main"> <div class="left"></div> <div class="right"></div> </div> <div class="footer">footer</div> </body> </html>