* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2.0 KiB
2.0 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
5a94fe4469fb03452672e460 | 使用 minmax 函数限制项目大小 | 0 | https://scrimba.com/p/pByETK/cD97RTv | 301131 | limit-item-size-using-the-minmax-function |
--description--
此外,内置函数 minmax
也可用于设置 grid-template-columns
和 grid-template-rows
的值。它的作用是在网格容器改变大小时限制网格项的大小。为此,你需要指定网格项允许的尺寸范围。例如:
grid-template-columns: 100px minmax(50px, 200px);
在上面的代码中,我们通过 grid-template-columns
添加了两列,第一列宽度为 100px,第二列宽度最小值是 50px,最大值是 200px。
--instructions--
请用 minmax
函数替换 repeat
函数中的 1fr
,限定其最小值为 90px
,最大值为1fr
。你可以调整最右侧的预览面板查看效果。
--hints--
class 为 container
的元素应使用 grid-template-columns
属性设置 3 列,其中,每列最小宽度应为 90px
,最大宽度应为 1fr
。
assert(
code.match(
/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?minmax\s*?\(\s*?90px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi
)
);
--seed--
--seed-contents--
<style>
.item1{background:LightSkyBlue;}
.item2{background:LightSalmon;}
.item3{background:PaleTurquoise;}
.item4{background:LightPink;}
.item5{background:PaleGreen;}
.container {
font-size: 40px;
min-height: 300px;
width: 100%;
background: LightGray;
display: grid;
/* Only change code below this line */
grid-template-columns: repeat(3, 1fr);
/* Only change code above this line */
grid-template-rows: 1fr 1fr 1fr;
grid-gap: 10px;
}
</style>
<div class="container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
<div class="item4">4</div>
<div class="item5">5</div>
</div>
--solutions--
<style>.container {grid-template-columns: repeat(3, minmax(90px, 1fr));}</style>