freeCodeCamp/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-animation-by-buil.../6140d10d50636e14695013b2.md

1.8 KiB

id title challengeType dashedName
6140d10d50636e14695013b2 步驟 9 0 step-9

--description--

爲你的 .line 元素創建一個選擇器。 設置 transform 屬性爲 rotate(60deg)

請記住,transform屬性允許你改變一個元素的形狀。 在這種情況下,使用 rotate(60deg) 值會將元素圍繞其 transform-origin 點順時針旋轉 60 度。

--hints--

你應該創建一個.line:nth-of-type(2) 選擇器。

assert(new __helpers.CSSHelp(document).getStyle('.line:nth-of-type(2)'));

你的 .line:nth-of-type(2) 選擇器應該有一個 transform 屬性值爲 rotate(60deg)

assert(new __helpers.CSSHelp(document).getStyle('.line:nth-of-type(2)')?.transform === 'rotate(60deg)');

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Ferris Wheel</title>
    <link rel="stylesheet" href="./styles.css">
  </head>
  <body>
    <div class="wheel">
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>

      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
    </div>
  </body>
</html>
.wheel {
  border: 2px solid black;
  border-radius: 50%;
  margin-left: 50px;
  position: absolute;
  height: 55vw;
  width: 55vw;
  max-width: 500px;
  max-height: 500px;
}

.line {
  background-color: black;
  width: 50%;
  height: 2px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: 0% 0%;
}

--fcc-editable-region--

--fcc-editable-region--