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

1.3 KiB

id title challengeType dashedName
60a3e3396c7b40068ad69975 步驟 12 0 step-12

--description--

使用 .frame 類選擇器編寫新規則。

使用 border 簡寫聲明爲 .frame 元素提供一個寬度爲 50px 的實心黑色邊框。

--hints--

代碼應該有一個 .frame 選擇器。

const hasFrame = new __helpers.CSSHelp(document).getStyle('.frame');
assert(hasFrame);

應該將 border 屬性設置爲 50px solid black

const hasBorder = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.border === '50px solid black');
assert(hasBorder);

.frame 元素應該有一個 50px solid black border

const frameBorder = new __helpers.CSSHelp(document).getStyle('.frame')?.getPropertyValue('border');
assert(frameBorder === '50px solid black');

--seed--

--seed-contents--

.canvas {
  width: 500px;
  height: 600px;
  background-color: #4d0f00;
}
--fcc-editable-region--

--fcc-editable-region--
<!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>
    </div>
  </body>
</html>