freeCodeCamp/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-the-css-box-model-by-.../60a3e3396c7b40068ad69980.md

1.4 KiB

id title challengeType dashedName
60a3e3396c7b40068ad69980 步驟 23 0 step-23

--description--

one 元素下方添加另一個 div,其 class 值爲 two。 這將是你的第二個矩形。

--hints--

不應更改現有的 .one 元素。

assert(document.querySelectorAll('.one').length === 1);

.canvas 元素中應該有第二個 div 元素。

assert(document.querySelector('.canvas').children[1].tagName === 'DIV');

第二個 div 元素的 class 值應爲 two

assert(document.querySelector('.canvas').children[1].className.split(' ').includes('two'));

.two 元素應該在 .one 元素之後。

assert(document.querySelector('.two').previousElementSibling.className.split(' ').includes('one'));

--seed--

--seed-contents--

.canvas {
  width: 500px;
  height: 600px;
  background-color: #4d0f00;
  overflow: hidden;
}

.frame {
  border: 50px solid black;
  width: 500px;
  padding: 50px;
  margin: 20px auto;
}

.one {
  width: 425px;
  height: 150px;
  background-color: #efb762;
  margin: 20px auto;
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Rothko Painting</title>
    <link href="./styles.css" rel="stylesheet">
  </head>
  <body>
    <div class="frame">
      <div class="canvas">
        <div class="one"></div>
--fcc-editable-region--

--fcc-editable-region--
      </div>
    </div>
  </body>
</html>