Files
freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/basic-css/style-the-html-body-element.chinese.md
2020-02-11 15:42:42 +09:00

1.4 KiB

id, title, challengeType, videoUrl, forumTopicId, localeTitle
id title challengeType videoUrl forumTopicId localeTitle
bad87fee1348bd9aedf08736 Style the HTML Body Element 0 https://scrimba.com/c/cB77PHW 18313 给 HTML 的 Body 元素添加样式

Description

现在让我们来讨论一下 CSS 继承。 每一个 HTML 页面都含有一个body元素。

Instructions

我们可以通过设置background-colorblack,来证明body元素的存在。 添加以下的代码到style标签里面:
body {
  background-color: black;
}

Tests

tests:
  - text: '<code>body</code>元素的<code>background-color</code>应该是黑色的。'
    testString: assert($("body").css("background-color") === "rgb(0, 0, 0)");
  - text: '确保 CSS 规则格式书写正确,需要开关大括号。'
    testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i));'
  - text: '确保 CSS 规则要以分号结尾。'
    testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i));'

Challenge Seed

<style>

</style>

Solution

// solution required