freeCodeCamp/curriculum/challenges/chinese-traditional/01-responsive-web-design/applied-visual-design/use-the-css-transform-prope...

1.3 KiB

id title challengeType videoUrl forumTopicId dashedName
587d78a6367417b2b2512adb 使用 CSS Transform skex 屬性沿X軸傾斜元素 0 https://scrimba.com/c/cyLP8Sr 301074 use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis

--description--

接下來要介紹的 transform 屬性是 skewX():它使選擇的元素沿着 X 軸(橫向)翻轉指定的角度。

下面的代碼沿着 X 軸翻轉段落元素 -32 度。

p {
  transform: skewX(-32deg);
}

--instructions--

使用 transform 屬性沿 X 軸翻轉 id 爲 bottom 的元素 24 度。

--hints--

id 爲 bottom 的元素應該沿着 X 軸翻轉 24 度。

assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g));

--seed--

--seed-contents--

<style>
  div {
    width: 70%;
    height: 100px;
    margin:  50px auto;
  }
  #top {
    background-color: red;
  }
  #bottom {
    background-color: blue;

  }
</style>

<div id="top"></div>
<div id="bottom"></div>

--solutions--

<style>
  div {
    width: 70%;
    height: 100px;
    margin:  50px auto;
  }
  #top {
    background-color: red;
  }
  #bottom {
    background-color: blue;
    transform: skewX(24deg);
  }
</style>
<div id="top"></div>
<div id="bottom"></div>