display: flex 子项指定宽度
<style> .father{ width:100%; background-color:red; height:400px; display:flex; } .son{ background-color:green; width:100%; flex-shrink:0; height:300px; } </style> <body> <div class="father"> <div class="son">1</div> <div class="son">2</div> <div class="son">3</div> </div> </body>
关键代码:flex-shrink:0;