CSS定宽居中的实现方案
方案1:使用flex来布局
.box{ width: 100%; height: 100px; display: flex; } .d1{ flex-grow: 1; flex-shrink: 1; } .d2{ flex-basis: 1080px; background-color: pink; flex-grow: 0; flex-shrink: 0; } .d3{ flex-grow: 1; flex-shrink: 1; }
.box{ width: 100%; height: 100px; display: flex; } .d1{ flex-grow: 1; flex-shrink: 1; } .d2{ flex-basis: 1080px; background-color: pink; flex-grow: 0; flex-shrink: 0; } .d3{ flex-grow: 1; flex-shrink: 1; }