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

78 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 587d78ab367417b2b2512af2
challengeType: 0
videoUrl: 'https://scrimba.com/p/pVaDAv/cBEkbfJ'
forumTopicId: 301110
title: 使用 flex-direction 属性创建一行
---
## Description
<section id='description'>
给元素添加<code>display: flex</code>属性使其变成 flex 容器。只要给父元素添加<code>flex-direction</code>属性,并把属性值设置为 row 或 column即可横排或竖排它的子元素。设为 row 可以让子元素水平排列,设为 column 可以让子元素垂直排列。
<code>flex-direction</code>的其他可选值还有 row-reverse 和 column-reverse。
<strong>注意</strong><br><code>flex-direction</code>的默认值为 row。
</section>
## Instructions
<section id='instructions'>
<code>#box-container</code>添加 CSS 属性<code>flex-direction</code>,其值设为 row-reverse。
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-container</code>应有<code>flex-direction</code>属性,其值应为 row-reverse。'
testString: assert($('#box-container').css('flex-direction') == 'row-reverse');
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<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>
```
</div>
</section>
## Solution
<section id='solution'>
```html
// solution required
```
</section>