* 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.4 KiB
1.4 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf08756 | 样式中的优先级 | 0 | https://scrimba.com/c/cZ8wnHv | 18258 | prioritize-one-style-over-another |
--description--
有时候,HTML 元素的样式会跟其他样式发生冲突。
就像 h1
元素也不能同时设置 green
和 pink
两种颜色。
让我们尝试创建一个字体颜色为 pink
的 class,并应于用其中一个元素中。猜一猜,它会覆盖 body
元素设置的 color: green;
CSS 规则吗?
--instructions--
创建一个能将元素的字体颜色改为 pink
的 class,并命名为 pink-text
。
给 h1
元素添加 pink-text
class。
--hints--
h1
元素应含有 pink-text
class。
assert($('h1').hasClass('pink-text'));
<style>
标签应含有一个可以改变字体颜色的 pink-text
class。
assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g));
h1
元素的字体颜色应为粉色。
assert($('h1').css('color') === 'rgb(255, 192, 203)');
--seed--
--seed-contents--
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
</style>
<h1>Hello World!</h1>
--solutions--
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
.pink-text {
color: pink;
}
</style>
<h1 class="pink-text">Hello World!</h1>