1.7 KiB
1.7 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
bad87fee1348bd9aedf08756 | Prioritize One Style Over Another | 0 | https://scrimba.com/c/cZ8wnHv | 18258 | 样式中的优先级 |
Description
h1
元素也不能同时设置green
和pink
两种样式。
让我们尝试创建一个字体颜色为pink
的 class,并应于用其中一个元素中。猜一猜,它会覆盖body
元素设置的color: green;
CSS 属性吗?
Instructions
pink
的CSS class,并起名为pink-text
。
给h1
元素添加pink-text
class。
Tests
tests:
- text: '<code>h1</code>元素应该含有<code>pink-text</code> class。'
testString: assert($("h1").hasClass("pink-text"));
- text: '<code><style></code>标签应该含有一个可以改变字体颜色的<code>pink-text</code> class。'
testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g));'
- text: '<code>h1</code>元素的字体颜色应该为<code>pink(粉色)</code>。'
testString: assert($("h1").css("color") === "rgb(255, 192, 203)");
Challenge Seed
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
</style>
<h1>Hello World!</h1>
Solution
// solution required