在答案https://stackoverflow.com/a/31672763/96233中,图像会延伸以填充"细胞"在弹性箱网格中。
当我用按钮尝试时,它们没有。
postToExternal: function(args, url) {
var deferred = this.doXhr(args,url);
return deferred;
}

grid-row {
display: flex;
width: 100%;
}
.narrow {
flex-grow: 1;
}
.wide {
flex-grow: 2;
}
.grid {
width: 300px;
height: 300px;
}
.grid button {
width: 100%;
height: auto;
vertical-align: middle;
flex-shrink: 1;
padding: 1px;
}

我做错了什么?
答案 0 :(得分:4)
你的代码中几乎没有错误,所以看起来应该是这样的。
.grid {
width: 300px;
height: 300px;
}
.grid-row {
display: flex;
}
.narrow {
flex: 1;
}
.wide {
flex: 2;
}

<div class="grid">
<div class="grid-row">
<button class="wide">1</button>
<button class="narrow">2</button>
<button class="narrow">3</button>
</div>
<div class="grid-row">
<button class="narrow">4</button>
<button class="wide">5</button>
<button class="narrow">6</button>
</div>
<div class="grid-row">
<button class="narrow">7</button>
<button class="narrow">8</button>
<button class="wide">9</button>
</div>
</div>
&#13;