<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <style> * { margin: 0; padding: 0; } .box { margin-top: 200px; height: 50px; background-color: pink; } .left { 50px; height: 50px; background-color: deepskyblue; /*左边的盒子左浮动*/ float: left; } .right { /*box-sizing: border-box;*/ /*padding-left: 50px;*/ height: 50px; background-color: orangered; /*右边的盒子设置overflow:hidden*/ overflow: hidden; } </style> </head> <body> <div class="box"> <div class="left"> 左边固定宽度 </div> <div class="right"> 右边宽度自适应, 右边宽度自适应, 右边宽度自适应,右边宽度自适应, 右边宽度自适应, 右边宽度自适应, 右边宽度自适应, 右边宽度自适应, 右边宽度自适应, 右边宽度自适应, 右边宽度自适应, 右边宽度自适应, </div> </div> </body> </html>