1.8 KiB
1.8 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
bad87fee1348bd9aedf08756 | Prioritize One Style Over Another | 0 | 将一种风格优先于另一种风格 |
Description
h1
元素不能同时为绿色和粉红色。让我们看看当我们创建一个使文本变为粉红色的类,然后将其应用于元素时会发生什么。我们的类会覆盖 body
元素的color: green;
CSS属性? Instructions
pink-text
的CSS类,它为元素提供粉红色。为你的h1
元素提供pink-text
类。 Tests
tests:
- text: 您的<code>h1</code>元素应该具有<code>pink-text</code>类。
testString: 'assert($("h1").hasClass("pink-text"), "Your <code>h1</code> element should have the class <code>pink-text</code>.");'
- text: 你的<code><style></code>应该有一个改变<code>color</code>的<code>pink-text</code> CSS类。
testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g), "Your <code><style></code> should have a <code>pink-text</code> CSS class that changes the <code>color</code>.");'
- text: 你的<code>h1</code>元素应该是粉红色的。
testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", "Your <code>h1</code> element should be pink.");'
Challenge Seed
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
</style>
<h1>Hello World!</h1>
Solution
// solution required