freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-the-html-body-element...

1.6 KiB

id title challengeType videoUrl localeTitle
bad87fee1348bd9aedf08736 Style the HTML Body Element 0 设置HTML Body Element的样式

Description

现在让我们重新开始讨论CSS继承。每个HTML页面都有一个body元素。

Instructions

我们可以通过给它一个黑色的background-color来证明body元素存在。我们可以通过在style元素中添加以下内容来实现:
身体 {
背景颜色:黑色;
}

Tests

tests:
  - text: 给你的<code>body</code>元素黑色的<code>background-color</code> 。
    testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", "Give your <code>body</code> element the <code>background-color</code> of black.");'
  - text: 确保您的CSS规则使用左右大括号正确格式化。
    testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i), "Make sure your CSS rule is properly formatted with both opening and closing curly brackets.");'
  - text: 确保您的CSS规则以分号结尾。
    testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i), "Make sure your CSS rule ends with a semi-colon.");'

Challenge Seed

<style>

</style>

Solution

// solution required