实例首页
自学教程
IT工具箱
源代码
下载代码
上下布局
点击运行 >
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>flex flex-grow、flex-shrink、flex-basis - 自学教程(runoops.com)</title> <style> .container { margin: 10px; display: flex; width: 500px; height: 200px; background-color: #eee; text-align: center; line-height: 100px; color: #666; } .item { width: 100px; height: 100px; } .a { flex-basis: 200px; background-color: #ff4466; } .b { max-width: 50px; flex-basis: 150px; background-color: #42b983; } .c { background-color: #61dafb; } </style> </head> <body> <div class="container"> <div class="item a">A</div> <div class="item b">B</div> <div class="item c">C</div> </div> </body> </html>
运行结果: