我的代码不能设置网格列。然而,我遵循的是与我在互联网上看到的完全相同的格式。有人知道答案吗?我认为可能是通过"重复"来实现的;函数创建相同宽度的6个网格列。(它可能在VSC中工作,但在Cengage中不起作用)
我的grid-template-rows工作得很好。
body {
width: 90%;
min-width: 640px;
max-width: 1024px;
margin-top: 30px;
margin-bottom: 30px;
margin-left: auto;
margin-right: auto;
display: grid;
gap: 15px;
grid-template-columns: 1fr repeat;
grid-template-rows: 50px 30px 1fr 1fr 100px;
}
grid-template-columns: 1fr repeat;
应该
grid-template-columns: repeat(6, 1fr);