<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>双飞翼</title> <style> *{ margin: 0; padding: 0; } .middle,.left,.right{ float: left; height: 200px; } .middle{ width: 100%; background:#ace; } .middle-inner{ margin: 0 30% 0 20%; } .left{ width: 20%; background:#eee; margin-left: -100%; } .right{ width:30%; background:#ddd; margin-left: -30%; } </style> </head> <body> <div> <div class="middle"> <div class="middle-inner"> middle-inner </div> </div> <div class="left"> left </div> <div class="right"> right </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>圣杯</title> <style> *{ margin: 0; padding: 0; } .container{ overflow: hidden; padding: 0 300px 0 200px; } .middle,.left,.right{ float: left; position: relative; min-height: 130px; } .middle{ width: 100%; background-color: red; } .left{ left:-200px; width: 200px; margin-left: -100%; background-color: beige; } .right{ right: -300px; width: 300px; margin-left: -300px; background-color: aquamarine; } </style> </head> <body> <div class="container"> <div class="middle"> middle </div> <div class="left"> left </div> <div class="right"> right </div> </div> </body> </html>