Files
freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.md
Oliver Eyton-Williams dec409a4bd fix: s/localeTitle/title/g
2020-10-06 23:10:08 +05:30

1.6 KiB
Raw Blame History

id, challengeType, videoUrl, forumTopicId, title
id challengeType videoUrl forumTopicId title
587d78ab367417b2b2512af2 0 https://scrimba.com/p/pVaDAv/cBEkbfJ 301110 使用 flex-direction 属性创建一行

Description

给元素添加display: flex属性使其变成 flex 容器。只要给父元素添加flex-direction属性,并把属性值设置为 row 或 column即可横排或竖排它的子元素。设为 row 可以让子元素水平排列,设为 column 可以让子元素垂直排列。 flex-direction的其他可选值还有 row-reverse 和 column-reverse。 注意
flex-direction的默认值为 row。

Instructions

#box-container添加 CSS 属性flex-direction,其值设为 row-reverse。

Tests

tests:
  - text: '<code>#box-container</code>应有<code>flex-direction</code>属性,其值应为 row-reverse。'
    testString: assert($('#box-container').css('flex-direction') == 'row-reverse');

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