<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>浮动</title> <style> *{ padding: 0; margin: 0; } .container{ width: 100%; background-color: green; min-height: 500px; } .left{ width: 200px; height: 300px; background-color: pink; float: left; } .right{ width: 150px; height: 300px; background-color: purple; float: right; } .center{ height: 300px; margin-left: 200px; margin-right: 150px; background-color: blue; } </style> </head> <body> <div class="container"> <div class="left"></div> <div class="right"></div> <div class="center"> 5236 </div> </div> </body> </html> 这个方法容易理解,但是记住不要给center设置宽度