-
实现要点:单列定宽,单列自适应
-
浮动实现
-
左边的盒子固定宽度,添加float:left
-
右边盒子宽度自适应, 添加margin-left:左盒子宽度。
-
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .box{ border: 1px solid #333; } .left{ width: 300px; height: 300px; background: red; float: left; } .right{ height:350px ; background: yellow; margin-left: 300px; } </style> </head> <body> <div class="box"> <div class="left"></div> <div class="right"> 我是文本内容</div> </div> </body> </html>