代码
提交代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .demo-2{ display:flex; } .item-left{ flex-basis: 100px; background: red; flex-shrink:0; } .item-right{ flex-basis: 600px; background: yellow; } </style> </head> <body> <div class="demo-2"> <div class="item-left"> 1 </div> <div class="item-right"> 2 </div> </div> </body> </html>
运行结果