2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 587d78ae367417b2b2512aff
|
|
|
|
|
challengeType: 0
|
2020-02-11 13:32:25 +00:00
|
|
|
|
videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvNAG'
|
|
|
|
|
forumTopicId: 301116
|
2020-10-01 15:54:21 +00:00
|
|
|
|
title: 使用 order 属性重新排列项目
|
2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-02-11 13:32:25 +00:00
|
|
|
|
<section id='description'>
|
|
|
|
|
<code>order</code>属性告诉 CSS flex 容器里项目的顺序。默认情况下,项目排列顺序与源 HTML 文件中顺序相同。这个属性接受数字作为参数,可以使用负数。
|
|
|
|
|
</section>
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
## Instructions
|
2020-02-11 13:32:25 +00:00
|
|
|
|
<section id='instructions'>
|
2020-03-03 13:41:15 +00:00
|
|
|
|
给<code>#box-1</code>和<code>#box-2</code>添加 CSS 属性<code>order</code>,<code>#box-1</code>的<code>order</code>属性值设为 <code>2</code>,<code>#box-2</code>的<code>order</code>属性值设为 <code>1</code>。
|
2020-02-11 13:32:25 +00:00
|
|
|
|
</section>
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
2020-03-03 13:41:15 +00:00
|
|
|
|
- text: <code>#box-1</code>元素应有<code>order</code>属性,其值应为 <code>2</code>。
|
2020-02-17 16:40:55 +00:00
|
|
|
|
testString: assert($('#box-1').css('order') == '2');
|
2020-03-03 13:41:15 +00:00
|
|
|
|
- text: <code>#box-2</code>元素应有<code>order</code>属性,其值应为 <code>1</code>。
|
2020-02-17 16:40:55 +00:00
|
|
|
|
testString: assert($('#box-2').css('order') == '1');
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<style>
|
|
|
|
|
#box-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
height: 500px;
|
|
|
|
|
}
|
|
|
|
|
#box-1 {
|
|
|
|
|
background-color: dodgerblue;
|
2020-02-11 13:32:25 +00:00
|
|
|
|
|
2018-10-10 22:03:03 +00:00
|
|
|
|
height: 200px;
|
|
|
|
|
width: 200px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#box-2 {
|
|
|
|
|
background-color: orangered;
|
2020-02-11 13:32:25 +00:00
|
|
|
|
|
2018-10-10 22:03:03 +00:00
|
|
|
|
height: 200px;
|
|
|
|
|
width: 200px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<div id="box-container">
|
|
|
|
|
<div id="box-1"></div>
|
|
|
|
|
<div id="box-2"></div>
|
|
|
|
|
</div>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
2020-02-11 13:32:25 +00:00
|
|
|
|
```html
|
2018-10-10 22:03:03 +00:00
|
|
|
|
// solution required
|
|
|
|
|
```
|
2020-02-11 13:32:25 +00:00
|
|
|
|
|
2018-10-10 22:03:03 +00:00
|
|
|
|
</section>
|
2020-02-11 13:32:25 +00:00
|
|
|
|
|