* 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>
1.1 KiB
1.1 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
587d78a3367417b2b2512ad0 | 使用 margin 属性将元素水平居中 | 0 | https://scrimba.com/c/cyLJqU4 | 301043 | center-an-element-horizontally-using-the-margin-property |
--description--
在应用设计中经常需要把一个块级元素水平居中显示。一种常见的实现方式是把块级元素的 margin
值设置为 auto
。
同样的,这个方法也对图片奏效。图片默认是内联元素,但是可以通过设置其 display
属性为 block
来把它变成块级元素。
--instructions--
通过将页面中 div
的 margin
属性值设置为 auto
来让它居中显示。
--hints--
div
的 margin
属性值应为 auto
。
assert(code.match(/margin:\s*?auto;/g));
--seed--
--seed-contents--
<style>
div {
background-color: blue;
height: 100px;
width: 100px;
}
</style>
<div></div>
--solutions--
<style>
div {
background-color: blue;
height: 100px;
width: 100px;
margin: auto;
}
</style>
<div></div>