预期输出:2行多列 我得到的输出:多行和 1 列 HTML
`<body>
<h1>Simple grid example</h1>
<div class="container">
<div >One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
<div>Five</div>
<div>Six</div>
<div>Seven</div>
</div>
</body>`
CSS
.container{ display:grid; grid-template-rows : auto auto; }
您需要使用包装器分隔行,如下所示:
<div class="container">
<div>
<div >One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
</div>
<div>
<div>Five</div>
<div>Six</div>
<div>Seven</div>
</div>
</div>