freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-prop...

1.4 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d78ac367417b2b2512af4 Use the flex-direction Property to Make a Column 0 使用flex-direction属性创建列

Description

最后两个挑战使用了flex-direction属性设置为row。此属性还可以通过垂直堆叠Flex容器的子项来创建列。

Instructions

将CSS属性flex-direction添加到#box-container元素并为其赋值column。

Tests

tests:
  - text: '<code>#box-container</code>元素应该将<code>flex-direction</code>属性设置为column。'
    testString: 'assert($("#box-container").css("flex-direction") == "column", "The <code>#box-container</code> element should have a <code>flex-direction</code> property set to column.");'

Challenge Seed

<style>
  #box-container {
    display: flex;
    height: 500px;

  }
  #box-1 {
    background-color: dodgerblue;
    width: 50%;
    height: 50%;
  }

  #box-2 {
    background-color: orangered;
    width: 50%;
    height: 50%;
  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>

Solution

// solution required