Add languages Russian, Arabic, Chinese, Portuguese (#18305)

This commit is contained in:
Beau Carnes
2018-10-10 18:03:03 -04:00
committed by mrugesh mohapatra
parent 09d3eca712
commit 2ca3a2093f
5517 changed files with 371466 additions and 5 deletions

View File

@ -0,0 +1,149 @@
---
id: 587d78ab367417b2b2512af1
title: Add Flex Superpowers to the Tweet Embed
challengeType: 0
videoUrl: ''
localeTitle: 添加Flex Superpowers到Tweet Embed
---
## Description
<section id="description">右侧是推文嵌入,将用作实际示例。使用不同的布局,一些元素看起来会更好。最后的挑战展示了<code>display: flex</code> 。在这里,您将把它添加到嵌入的推文中的几个组件,以开始调整它们的位置。 </section>
## Instructions
<section id="instructions">将CSS属性<code>display: flex</code>添加到以下所有项目中 - 请注意选择器已经设置在CSS <code>header</code> ,标题的<code>.profile-name</code> ,标题的<code>.follow-btn</code> ,标题的<code>h3</code><code>h4</code> <code>footer</code>和页脚的<code>.stats</code></section>
## Tests
<section id='tests'>
```yml
tests:
- text: 您的<code>header</code>应该具有设置为flex的<code>display</code>属性。
testString: 'assert($("header").css("display") == "flex", "Your <code>header</code> should have a <code>display</code> property set to flex.");'
- text: 您的<code>footer</code>应该具有设置为flex的<code>display</code>属性。
testString: 'assert($("footer").css("display") == "flex", "Your <code>footer</code> should have a <code>display</code> property set to flex.");'
- text: 你的<code>h3</code>应该有一个<code>display</code>属性设置为flex。
testString: 'assert($("h3").css("display") == "flex", "Your <code>h3</code> should have a <code>display</code> property set to flex.");'
- text: 你的<code>h4</code>应该有一个<code>display</code>属性设置为flex。
testString: 'assert($("h4").css("display") == "flex", "Your <code>h4</code> should have a <code>display</code> property set to flex.");'
- text: 您的<code>.profile-name</code>应该将<code>display</code>属性设置为flex。
testString: 'assert($(".profile-name").css("display") == "flex", "Your <code>.profile-name</code> should have a <code>display</code> property set to flex.");'
- text: 你的<code>.follow-btn</code>应该有一个<code>display</code>属性设置为flex。
testString: 'assert($(".follow-btn").css("display") == "flex", "Your <code>.follow-btn</code> should have a <code>display</code> property set to flex.");'
- text: 您的<code>.stats</code>应该将<code>display</code>属性设置为flex。
testString: 'assert($(".stats").css("display") == "flex", "Your <code>.stats</code> should have a <code>display</code> property set to flex.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
body {
font-family: Arial, sans-serif;
}
header {
}
header .profile-thumbnail {
width: 50px;
height: 50px;
border-radius: 4px;
}
header .profile-name {
margin-left: 10px;
}
header .follow-btn {
margin: 0 0 0 auto;
}
header .follow-btn button {
border: 0;
border-radius: 3px;
padding: 5px;
}
header h3, header h4 {
margin: 0;
}
#inner p {
margin-bottom: 10px;
font-size: 20px;
}
#inner hr {
margin: 20px 0;
border-style: solid;
opacity: 0.1;
}
footer {
}
footer .stats {
font-size: 15px;
}
footer .stats strong {
font-size: 18px;
}
footer .stats .likes {
margin-left: 10px;
}
footer .cta {
margin-left: auto;
}
footer .cta button {
border: 0;
background: transparent;
}
</style>
<header>
<img src="https://pbs.twimg.com/profile_images/378800000147359764/54dc9a5c34e912f34db8662d53d16a39_400x400.png" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<div class="profile-name">
<h3>Quincy Larson</h3>
<h4>@ossia</h4>
</div>
<div class="follow-btn">
<button>Follow</button>
</div>
</header>
<div id="inner">
<p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<span class="date">1:32 PM - 12 Jan 2018</span>
<hr>
</div>
<footer>
<div class="stats">
<div class="Retweets">
<strong>107</strong> Retweets
</div>
<div class="likes">
<strong>431</strong> Likes
</div>
</div>
<div class="cta">
<button class="share-btn">Share</button>
<button class="retweet-btn">Retweet</button>
<button class="like-btn">Like</button>
</div>
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,72 @@
---
id: 587d78ad367417b2b2512af8
title: Align Elements Using the align-items Property
challengeType: 0
videoUrl: ''
localeTitle: 使用align-items属性对齐元素
---
## Description
<section id="description"> <code>align-items</code>属性类似于<code>justify-content</code> 。回想一下, <code>justify-content</code>属性沿主轴对齐flex项目。对于行主轴是水平线对于列它是垂直线。 Flex容器还具有与<strong>主轴</strong>相反的横轴。对于行,横轴是垂直的,对于列,横轴是水平的。 CSS提供<code>align-items</code>属性以沿着交叉轴对齐flex项。对于一行它告诉CSS如何在容器内向上或向下推动整行中的项目。对于列如何在容器内向左或向右推送所有项目。 <code>align-items</code>可用的不同值包括: <ul><li> <code>flex-start</code> 将项目对齐到Flex容器的开头。对于行这会将项目对齐到容器的顶部。对于列这会将项目对齐到容器的左侧。 </li><li> <code>flex-end</code> 将项目对齐到Flex容器的末尾。对于行这会将项目对齐到容器的底部。对于列这会将项目对齐到容器的右侧。 </li><li> <code>center</code> :将项目对齐到中心。对于行,这会垂直对齐项目(项目上方和下方的空格相等)。对于列,它会水平对齐它们(项目左侧和右侧的空格相等)。 </li><li> <code>stretch</code> 拉伸项目以填充弹性容器。例如行项目被拉伸以从上到下填充Flex容器。 </li><li> <code>baseline</code> :将项目与其基线对齐。基线是一个文本概念,将其视为字母所在的行。 </li></ul></section>
## Instructions
<section id="instructions">一个示例有助于显示此属性的运行情况。将CSS属性<code>align-items</code>添加到<code>#box-container</code>元素并为其指定center值。 <strong>奖金</strong> <br>在代码编辑器中尝试使用<code>align-items</code>属性的其他选项来查看它们之间的差异。但请注意,中心值是唯一能够通过此挑战的值。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-container</code>元素的<code>align-items</code>属性应设置为center的值。'
testString: 'assert($("#box-container").css("align-items") == "center", "The <code>#box-container</code> element should have an <code>align-items</code> property set to a value of center.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
background: gray;
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
width: 200px;
font-size: 24px;
}
#box-2 {
background-color: orangered;
width: 200px;
font-size: 18px;
}
</style>
<div id="box-container">
<div id="box-1"><p>Hello</p></div>
<div id="box-2"><p>Goodbye</p></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,72 @@
---
id: 587d78ac367417b2b2512af6
title: Align Elements Using the justify-content Property
challengeType: 0
videoUrl: ''
localeTitle: 使用justify-content属性对齐元素
---
## Description
<section id="description">有时flex容器中的flex项不会填充容器中的所有空间。通常希望告诉CSS如何以特定方式对齐和展开弹性项目。幸运的是 <code>justify-content</code>属性有几个选项可以做到这一点。但首先,在审查这些选项之前,需要了解一些重要的术语。 <a href="https://www.w3.org/TR/css-flexbox-1/images/flex-direction-terms.svg" target="_blank">这是一个有用的图像,显​​示了一行来说明下面的概念。</a>回想一下将flex容器设置为一行可以从左到右并排放置Flex项目。设置为列的弹性容器将弹性项目从上到下放置在垂直堆栈中。对于每个柔性项目的排列方向称为<strong>主轴</strong> 。对于一行,这是一条切割每个项目的水平线。对于列,主轴是穿过项目的垂直线。如何沿着作为主轴的直线对弹性项目进行间隔有几种选择。其中最常用的是<code>justify-content: center;</code> 将所有弹性项目对齐到Flex容器内的中心。其他选择包括 <ul><li> <code>flex-start</code> 将项目对齐到Flex容器的开头。对于一行这会将项目推送到容器的左侧。对于列这会将项目推送到容器的顶部。 </li><li> <code>flex-end</code> 将项目对齐到Flex容器的末尾。对于一行这会将项目推送到容器的右侧。对于列这会将项目推送到容器的底部。 </li><li> <code>space-between</code> 将项目与主轴的中心对齐在项目之间放置额外的空间。第一个和最后一个项目被推送到Flex容器的最边缘。例如在第一项中第一项是在容器的左侧最后一项是在容器的右侧然后它们之间的其他项是均匀间隔的。 </li><li> <code>space-around</code> :类似于<code>space-between</code>但是第一个和最后一个项目没有锁定到容器的边缘,空间分布在所有项目周围</li></ul></section>
## Instructions
<section id="instructions">一个示例有助于显示此属性的运行情况。将CSS属性<code>justify-content</code>添加到<code>#box-container</code>元素并为其赋值为center。 <strong>奖金</strong> <br>在代码编辑器中尝试使用<code>justify-content</code>属性的其他选项来查看它们之间的差异。但请注意,中心值是唯一能够通过此挑战的值。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-container</code>元素应该将<code>justify-content</code>属性设置为center的值。'
testString: 'assert($("#box-container").css("justify-content") == "center", "The <code>#box-container</code> element should have a <code>justify-content</code> property set to a value of center.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
background: gray;
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
width: 25%;
height: 100%;
}
#box-2 {
background-color: orangered;
width: 25%;
height: 100%;
}
</style>
<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,136 @@
---
id: 587d78ac367417b2b2512af5
title: Apply the flex-direction Property to Create a Column in the Tweet Embed
challengeType: 0
videoUrl: ''
localeTitle: 应用flex-direction属性在Tweet Embed中创建一个列
---
## Description
<section id="description"> tweet嵌入<code>header</code><code>footer</code>先前使用了<code>flex-direction</code>属性和行值。同样, <code>.profile-name</code>元素中的项目可以很好地堆叠为列。 </section>
## Instructions
<section id="instructions">将CSS属性<code>flex-direction</code>添加到标头的<code>.profile-name</code>元素并将值设置为column。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>.profile-name</code>元素应将<code>flex-direction</code>属性设置为column。
testString: 'assert($(".profile-name").css("flex-direction") == "column", "The <code>.profile-name</code> element should have a <code>flex-direction</code> property set to column.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
body {
font-family: Arial, sans-serif;
}
header, footer {
display: flex;
flex-direction: row;
}
header .profile-thumbnail {
width: 50px;
height: 50px;
border-radius: 4px;
}
header .profile-name {
display: flex;
margin-left: 10px;
}
header .follow-btn {
display: flex;
margin: 0 0 0 auto;
}
header .follow-btn button {
border: 0;
border-radius: 3px;
padding: 5px;
}
header h3, header h4 {
display: flex;
margin: 0;
}
#inner p {
margin-bottom: 10px;
font-size: 20px;
}
#inner hr {
margin: 20px 0;
border-style: solid;
opacity: 0.1;
}
footer .stats {
display: flex;
font-size: 15px;
}
footer .stats strong {
font-size: 18px;
}
footer .stats .likes {
margin-left: 10px;
}
footer .cta {
margin-left: auto;
}
footer .cta button {
border: 0;
background: transparent;
}
</style>
<header>
<img src="https://pbs.twimg.com/profile_images/378800000147359764/54dc9a5c34e912f34db8662d53d16a39_400x400.png" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<div class="profile-name">
<h3>Quincy Larson</h3>
<h4>@ossia</h4>
</div>
<div class="follow-btn">
<button>Follow</button>
</div>
</header>
<div id="inner">
<p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<span class="date">1:32 PM - 12 Jan 2018</span>
<hr>
</div>
<footer>
<div class="stats">
<div class="Retweets">
<strong>107</strong> Retweets
</div>
<div class="likes">
<strong>431</strong> Likes
</div>
</div>
<div class="cta">
<button class="share-btn">Share</button>
<button class="retweet-btn">Retweet</button>
<button class="like-btn">Like</button>
</div>
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,141 @@
---
id: 587d78ab367417b2b2512af3
title: Apply the flex-direction Property to Create Rows in the Tweet Embed
challengeType: 0
videoUrl: ''
localeTitle: 应用flex-direction属性在Tweet Embed中创建行
---
## Description
<section id="description"> tweet嵌入示例中的<code>header</code><code>footer</code>具有可以使用<code>flex-direction</code>属性排列为行的子项。这告诉CSS水平对齐孩子。 </section>
## Instructions
<section id="instructions">将CSS属性<code>flex-direction</code>添加到<code>header</code><code>footer</code> 并将值设置为row。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>header</code>应该将<code>flex-direction</code>属性设置为row。
testString: 'assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g), "The <code>header</code> should have a <code>flex-direction</code> property set to row.");'
- text: <code>footer</code>应将<code>flex-direction</code>属性设置为row。
testString: 'assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g), "The <code>footer</code> should have a <code>flex-direction</code> property set to row.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
body {
font-family: Arial, sans-serif;
}
header {
display: flex;
}
header .profile-thumbnail {
width: 50px;
height: 50px;
border-radius: 4px;
}
header .profile-name {
display: flex;
margin-left: 10px;
}
header .follow-btn {
display: flex;
margin: 0 0 0 auto;
}
header .follow-btn button {
border: 0;
border-radius: 3px;
padding: 5px;
}
header h3, header h4 {
display: flex;
margin: 0;
}
#inner p {
margin-bottom: 10px;
font-size: 20px;
}
#inner hr {
margin: 20px 0;
border-style: solid;
opacity: 0.1;
}
footer {
display: flex;
}
footer .stats {
display: flex;
font-size: 15px;
}
footer .stats strong {
font-size: 18px;
}
footer .stats .likes {
margin-left: 10px;
}
footer .cta {
margin-left: auto;
}
footer .cta button {
border: 0;
background: transparent;
}
</style>
<header>
<img src="https://pbs.twimg.com/profile_images/378800000147359764/54dc9a5c34e912f34db8662d53d16a39_400x400.png" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<div class="profile-name">
<h3>Quincy Larson</h3>
<h4>@ossia</h4>
</div>
<div class="follow-btn">
<button>Follow</button>
</div>
</header>
<div id="inner">
<p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<span class="date">1:32 PM - 12 Jan 2018</span>
<hr>
</div>
<footer>
<div class="stats">
<div class="Retweets">
<strong>107</strong> Retweets
</div>
<div class="likes">
<strong>431</strong> Likes
</div>
</div>
<div class="cta">
<button class="share-btn">Share</button>
<button class="retweet-btn">Retweet</button>
<button class="like-btn">Like</button>
</div>
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,72 @@
---
id: 587d78ab367417b2b2512af0
title: 'Use display: flex to Position Two Boxes'
challengeType: 0
videoUrl: ''
localeTitle: 使用displayflex定位两个Box
---
## Description
<section id="description">本节使用交替挑战样式来展示如何使用CSS以灵活的方式定位元素。首先挑战将解释理论然后使用简单推文组件的实际挑战将应用flexbox概念。放置CSS属性<code>display: flex;</code>在元素上允许您使用其他flex属性来构建响应式页面。 </section>
## Instructions
<section id="instructions">将CSS属性<code>display</code>添加到<code>#box-container</code>并将其值设置为flex。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-container</code>应将<code>display</code>属性设置为flex值。'
testString: 'assert($("#box-container").css("display") == "flex", "<code>#box-container</code> should have the <code>display</code> property set to a value of flex.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
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'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,139 @@
---
id: 587d78ad367417b2b2512af9
title: Use the align-items Property in the Tweet Embed
challengeType: 0
videoUrl: ''
localeTitle: 使用Tweet Embed中的align-items属性
---
## Description
<section id="description">最后一个挑战引入了<code>align-items</code>属性并举了一个例子。此属性可应用于一些tweet嵌入元素以对齐其中的flex项。 </section>
## Instructions
<section id="instructions">将CSS属性<code>align-items</code>添加到标题的<code>.follow-btn</code>元素中。将值设置为居中。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>.follow-btn</code>元素应将<code>align-items</code>属性设置为center的值。
testString: 'assert($(".follow-btn").css("align-items") == "center", "The <code>.follow-btn</code> element should have the <code>align-items</code> property set to a value of center.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
body {
font-family: Arial, sans-serif;
}
header, footer {
display: flex;
flex-direction: row;
}
header .profile-thumbnail {
width: 50px;
height: 50px;
border-radius: 4px;
}
header .profile-name {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 10px;
}
header .follow-btn {
display: flex;
margin: 0 0 0 auto;
}
header .follow-btn button {
border: 0;
border-radius: 3px;
padding: 5px;
}
header h3, header h4 {
display: flex;
margin: 0;
}
#inner p {
margin-bottom: 10px;
font-size: 20px;
}
#inner hr {
margin: 20px 0;
border-style: solid;
opacity: 0.1;
}
footer .stats {
display: flex;
font-size: 15px;
}
footer .stats strong {
font-size: 18px;
}
footer .stats .likes {
margin-left: 10px;
}
footer .cta {
margin-left: auto;
}
footer .cta button {
border: 0;
background: transparent;
}
</style>
<header>
<img src="https://pbs.twimg.com/profile_images/378800000147359764/54dc9a5c34e912f34db8662d53d16a39_400x400.png" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<div class="profile-name">
<h3>Quincy Larson</h3>
<h4>@ossia</h4>
</div>
<div class="follow-btn">
<button>Follow</button>
</div>
</header>
<div id="inner">
<p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<span class="date">1:32 PM - 12 Jan 2018</span>
<hr>
</div>
<footer>
<div class="stats">
<div class="Retweets">
<strong>107</strong> Retweets
</div>
<div class="likes">
<strong>431</strong> Likes
</div>
</div>
<div class="cta">
<button class="share-btn">Share</button>
<button class="retweet-btn">Retweet</button>
<button class="like-btn">Like</button>
</div>
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,74 @@
---
id: 587d78af367417b2b2512b00
title: Use the align-self Property
challengeType: 0
videoUrl: ''
localeTitle: 使用align-self属性
---
## Description
<section id="description"> flex项的最终属性是<code>align-self</code> 。此属性允许您单独调整每个项目的对齐方式而不是一次性设置它们。这很有用因为使用CSS属性<code>float</code> <code>clear</code><code>vertical-align</code>其他常用调整技术对flex项不起作用。 <code>align-self</code>接受与<code>align-items</code>相同的值,并将覆盖<code>align-items</code>属性设置的任何值。 </section>
## Instructions
<section id="instructions">将CSS属性<code>align-self</code>添加到<code>#box-1</code><code>#box-2</code> 。给<code>#box-1</code>一个中心值,给<code>#box-2</code>一个flex-end值。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-1</code>元素应将<code>align-self</code>属性设置为center的值。'
testString: 'assert($("#box-1").css("align-self") == "center", "The <code>#box-1</code> element should have the <code>align-self</code> property set to a value of center.");'
- text: '<code>#box-2</code>元素应该将<code>align-self</code>属性设置为flex-end的值。'
testString: 'assert($("#box-2").css("align-self") == "flex-end", "The <code>#box-2</code> element should have the <code>align-self</code> property set to a value of flex-end.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
height: 200px;
width: 200px;
}
#box-2 {
background-color: orangered;
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'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,77 @@
---
id: 587d78ae367417b2b2512afd
title: Use the flex-basis Property to Set the Initial Size of an Item
challengeType: 0
videoUrl: ''
localeTitle: 使用flex-basis属性设置项的初始大小
---
## Description
<section id="description"> <code>flex-basis</code>属性指定CSS在使用<code>flex-shrink</code><code>flex-grow</code>进行调整之前的项的初始大小。 <code>flex-basis</code>属性使用的单位与其他大小属性( <code>px</code> <code>em</code> <code>%</code>等)相同。该值根据内容<code>auto</code>项目大小。 </section>
## Instructions
<section id="instructions">使用<code>flex-basis</code>设置框的初始大小。将CSS属性<code>flex-basis</code>添加到<code>#box-1</code><code>#box-2</code> 。给<code>#box-1</code>一个值为<code>10em</code> <code>#box-2</code>给一个值为<code>20em</code></section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-1</code>元素应该具有<code>flex-basis</code>属性。'
testString: 'assert($("#box-1").css("flex-basis") != "auto", "The <code>#box-1</code> element should have a <code>flex-basis</code> property.");'
- text: '<code>#box-1</code>元素的<code>flex-basis</code>值应为<code>10em</code> 。'
testString: 'assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g), "The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.");'
- text: '<code>#box-2</code>元素应该具有<code>flex-basis</code>属性。'
testString: 'assert($("#box-2").css("flex-basis") != "auto", "The <code>#box-2</code> element should have the <code>flex-basis</code> property.");'
- text: '<code>#box-2</code>元素的<code>flex-basis</code>值应为<code>20em</code> 。'
testString: 'assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g), "The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
height: 200px;
}
#box-2 {
background-color: orangered;
height: 200px;
}
</style>
<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,71 @@
---
id: 587d78ac367417b2b2512af4
title: Use the flex-direction Property to Make a Column
challengeType: 0
videoUrl: ''
localeTitle: 使用flex-direction属性创建列
---
## Description
<section id="description">最后两个挑战使用了<code>flex-direction</code>属性设置为row。此属性还可以通过垂直堆叠Flex容器的子项来创建列。 </section>
## Instructions
<section id="instructions">将CSS属性<code>flex-direction</code>添加到<code>#box-container</code>元素并为其赋值column。 </section>
## Tests
<section id='tests'>
```yml
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.");'
```
</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'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,71 @@
---
id: 587d78ab367417b2b2512af2
title: Use the flex-direction Property to Make a Row
challengeType: 0
videoUrl: ''
localeTitle: 使用flex-direction属性创建一行
---
## Description
<section id="description">添加<code>display: flex</code> to a element将其转换为flex容器。这使得可以将该元素的任何子节点对齐成行或列。您可以通过将<code>flex-direction</code>属性添加到父项并将其设置为行或列来完成此操作。创建行将水平对齐子项,创建列将垂直对齐子项。 <code>flex-direction</code>其他选项是row-reverse和column-reverse。 <strong>注意</strong> <br> <code>flex-direction</code>属性的默认值为row。 </section>
## Instructions
<section id="instructions">将CSS属性<code>flex-direction</code>添加到<code>#box-container</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", "The <code>#box-container</code> element should have a <code>flex-direction</code> property set to 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'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,73 @@
---
id: 587d78ae367417b2b2512afc
title: Use the flex-grow Property to Expand Items
challengeType: 0
videoUrl: ''
localeTitle: 使用flex-grow属性扩展项目
---
## Description
<section id="description"><code>flex-shrink</code>相反的是<code>flex-grow</code>属性。回想一下,当容器缩小时, <code>flex-shrink</code>控制项目的大小。当父容器展开时, <code>flex-grow</code>属性控制项的大小。使用上一个挑战中的类似示例,如果一个项目的<code>flex-grow</code>值为1而另一个项目的<code>flex-grow</code>值为3则值为3的项目将增长为另一个项目的三倍。 </section>
## Instructions
<section id="instructions">将CSS属性<code>flex-grow</code>添加到<code>#box-1</code><code>#box-2</code> 。将<code>#box-1</code>的值设为1<code>#box-2</code>的值设为2。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-1</code>元素应将<code>flex-grow</code>属性设置为值1。'
testString: 'assert($("#box-1").css("flex-grow") == "1", "The <code>#box-1</code> element should have the <code>flex-grow</code> property set to a value of 1.");'
- text: '<code>#box-2</code>元素应将<code>flex-grow</code>属性设置为值2。'
testString: 'assert($("#box-2").css("flex-grow") == "2", "The <code>#box-2</code> element should have the <code>flex-grow</code> property set to a value of 2.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
height: 200px;
}
#box-2 {
background-color: orangered;
height: 200px;
}
</style>
<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,74 @@
---
id: 587d78ae367417b2b2512afe
title: Use the flex Shorthand Property
challengeType: 0
videoUrl: ''
localeTitle: 使用flex速记属性
---
## Description
<section id="description">有一个快捷方式可以同时设置多个flex属性。通过使用<code>flex</code>属性,可以将<code>flex-grow</code> <code>flex-shrink</code><code>flex-basis</code>属性设置在一起。例如, <code>flex: 1 0 10px;</code>将项目设置为<code>flex-grow: 1;</code> <code>flex-shrink: 0;</code> ,和<code>flex-basis: 10px;</code> 。默认属性设置为<code>flex: 0 1 auto;</code></section>
## Instructions
<section id="instructions">将CSS属性<code>flex</code>添加到<code>#box-1</code><code>#box-2</code> 。给<code>#box-1</code>赋值,使<code>flex-grow</code>为2 <code>flex-shrink</code>为2 <code>flex-basis</code>为150px。给<code>#box-2</code>赋值,使<code>flex-grow</code>为1 <code>flex-shrink</code>为1<code>flex-basis</code>为150px。这些值将导致<code>#box-1</code>增长以在容器大于300px时以<code>#box-2</code>两倍速率填充额外空间并在容器小于300px时以<code>#box-2</code>的速率缩小两倍。 300px是两个框的<code>flex-basis</code>值的组合大小。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-1</code>元素的<code>flex</code>属性应设置为2 2 150px。'
testString: 'assert($("#box-1").css("flex-grow") == "2" && $("#box-1").css("flex-shrink") == "2" && $("#box-1").css("flex-basis") == "150px", "The <code>#box-1</code> element should have the <code>flex</code> property set to a value of 2 2 150px.");'
- text: '<code>#box-2</code>元素的<code>flex</code>属性应设置为1 1 150px。'
testString: 'assert($("#box-2").css("flex-grow") == "1" && $("#box-2").css("flex-shrink") == "1" && $("#box-2").css("flex-basis") == "150px", "The <code>#box-2</code> element should have the <code>flex</code> property set to a value of 1 1 150px.");'
- text: '您的代码应该使用<code>#box-1</code>和<code>#box-2</code>的<code>flex</code>属性。'
testString: 'assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2, "Your code should use the <code>flex</code> property for <code>#box-1</code> and <code>#box-2</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
height: 200px;
}
#box-2 {
background-color: orangered;
height: 200px;
}
</style>
<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,74 @@
---
id: 587d78ad367417b2b2512afb
title: Use the flex-shrink Property to Shrink Items
challengeType: 0
videoUrl: ''
localeTitle: 使用flex-shrink属性收缩项目
---
## Description
<section id="description">到目前为止挑战中的所有属性都适用于Flex容器flex项的父级。但是flex项有几个有用的属性。第一个是<code>flex-shrink</code>属性。当它被使用时如果柔性容器太小它允许物品收缩。当父容器的宽度小于其中所有flex项的组合宽度时项会收缩。 <code>flex-shrink</code>属性将数字作为值。数字越大,与容器中的其他项目相比,它将收缩得越多。例如,如果一个项目的<code>flex-shrink</code>值为1而另一个项目的<code>flex-shrink</code>值为3则值为3的项目将缩小为另一个项目的三倍。 </section>
## Instructions
<section id="instructions">将CSS属性<code>flex-shrink</code>添加到<code>#box-1</code><code>#box-2</code> 。将<code>#box-1</code>的值设为1<code>#box-2</code>的值设为2。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-1</code>元素应将<code>flex-shrink</code>属性设置为值1。'
testString: 'assert($("#box-1").css("flex-shrink") == "1", "The <code>#box-1</code> element should have the <code>flex-shrink</code> property set to a value of 1.");'
- text: '<code>#box-2</code>元素的<code>flex-shrink</code>属性应设置为值2。'
testString: 'assert($("#box-2").css("flex-shrink") == "2", "The <code>#box-2</code> element should have the <code>flex-shrink</code> property set to a value of 2.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
width: 100%;
height: 200px;
}
#box-2 {
background-color: orangered;
width: 100%;
height: 200px;
}
</style>
<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,96 @@
---
id: 587d78ad367417b2b2512afa
title: Use the flex-wrap Property to Wrap a Row or Column
challengeType: 0
videoUrl: ''
localeTitle: 使用flex-wrap属性包装行或列
---
## Description
<section id="description"> CSS flexbox具有将flex项分割为多行或列的功能。默认情况下Flex容器将所有Flex项目放在一起。例如一行将全部在一行上。但是使用<code>flex-wrap</code>属性它会告诉CSS包装项目。这意味着额外的项目将移动到新的行或列中。包装发生的断点取决于物品的大小和容器的大小。 CSS还有包装方向的选项 <ul><li> <code>nowrap</code> :这是默认设置,不包装项目。 </li><li> <code>wrap</code> :如果项目在一行中,则从左到右包装,如果它们在列中,则从上到下包装。 </li><li> <code>wrap-reverse</code> :如果项目在一行中,则从下到上包装项目;如果它们在列中,则从右到左包装。 </li></ul></section>
## Instructions
<section id="instructions">当前布局对于一行有太多的框。将CSS属性<code>flex-wrap</code>添加到<code>#box-container</code>元素并为其赋值wrap。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-container</code>元素应该将<code>flex-wrap</code>属性设置为wrap值。'
testString: 'assert($("#box-container").css("flex-wrap") == "wrap", "The <code>#box-container</code> element should have the <code>flex-wrap</code> property set to a value of wrap.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
background: gray;
display: flex;
height: 100%;
}
#box-1 {
background-color: dodgerblue;
width: 25%;
height: 50%;
}
#box-2 {
background-color: orangered;
width: 25%;
height: 50%;
}
#box-3 {
background-color: violet;
width: 25%;
height: 50%;
}
#box-4 {
background-color: yellow;
width: 25%;
height: 50%;
}
#box-5 {
background-color: green;
width: 25%;
height: 50%;
}
#box-6 {
background-color: black;
width: 25%;
height: 50%;
}
</style>
<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
<div id="box-3"></div>
<div id="box-4"></div>
<div id="box-5"></div>
<div id="box-6"></div>
</div>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,137 @@
---
id: 587d78ac367417b2b2512af7
title: Use the justify-content Property in the Tweet Embed
challengeType: 0
videoUrl: ''
localeTitle: 在Tweet Embed中使用justify-content属性
---
## Description
<section id="description">最后一项挑战展示了一个<code>justify-content</code>属性的例子。对于tweet嵌入可以应用此属性来对齐<code>.profile-name</code>元素中的项目。 </section>
## Instructions
<section id="instructions">将CSS属性<code>justify-content</code>添加到标头的<code>.profile-name</code>元素,并将值设置为上一个挑战中的任何选项。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>.profile-name</code>元素应将<code>justify-content</code>属性设置为以下任何值centerflex-startflex-endspace-between或space-around。
testString: 'assert(code.match(/header\s.profile-name\s*{\s*?.*?\s*?.*?\s*?\s*?.*?\s*?justify-content\s*:\s*(center|flex-start|flex-end|space-between|space-around)\s*;/g), "The <code>.profile-name</code> element should have the <code>justify-content</code> property set to any of these values: center, flex-start, flex-end, space-between, or space-around.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
body {
font-family: Arial, sans-serif;
}
header, footer {
display: flex;
flex-direction: row;
}
header .profile-thumbnail {
width: 50px;
height: 50px;
border-radius: 4px;
}
header .profile-name {
display: flex;
flex-direction: column;
margin-left: 10px;
}
header .follow-btn {
display: flex;
margin: 0 0 0 auto;
}
header .follow-btn button {
border: 0;
border-radius: 3px;
padding: 5px;
}
header h3, header h4 {
display: flex;
margin: 0;
}
#inner p {
margin-bottom: 10px;
font-size: 20px;
}
#inner hr {
margin: 20px 0;
border-style: solid;
opacity: 0.1;
}
footer .stats {
display: flex;
font-size: 15px;
}
footer .stats strong {
font-size: 18px;
}
footer .stats .likes {
margin-left: 10px;
}
footer .cta {
margin-left: auto;
}
footer .cta button {
border: 0;
background: transparent;
}
</style>
<header>
<img src="https://pbs.twimg.com/profile_images/378800000147359764/54dc9a5c34e912f34db8662d53d16a39_400x400.png" alt="Quincy Larson's profile picture" class="profile-thumbnail">
<div class="profile-name">
<h3>Quincy Larson</h3>
<h4>@ossia</h4>
</div>
<div class="follow-btn">
<button>Follow</button>
</div>
</header>
<div id="inner">
<p>I meet so many people who are in search of that one trick that will help them work smart. Even if you work smart, you still have to work hard.</p>
<span class="date">1:32 PM - 12 Jan 2018</span>
<hr>
</div>
<footer>
<div class="stats">
<div class="Retweets">
<strong>107</strong> Retweets
</div>
<div class="likes">
<strong>431</strong> Likes
</div>
</div>
<div class="cta">
<button class="share-btn">Share</button>
<button class="retweet-btn">Retweet</button>
<button class="like-btn">Like</button>
</div>
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,74 @@
---
id: 587d78ae367417b2b2512aff
title: Use the order Property to Rearrange Items
challengeType: 0
videoUrl: ''
localeTitle: 使用order属性重新排列项目
---
## Description
<section id="description"> <code>order</code>属性用于告诉CSS Flex项目在Flex容器中的显示顺序。默认情况下项目将以与源HTML相同的顺序显示。该属性将数字作为值可以使用负数。 </section>
## Instructions
<section id="instructions">将CSS属性<code>order</code>添加到<code>#box-1</code><code>#box-2</code> 。给<code>#box-1</code>一个值2<code>#box-2</code>一个值1。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>#box-1</code>元素的<code>order</code>属性应设置为值2。'
testString: 'assert($("#box-1").css("order") == "2", "The <code>#box-1</code> element should have the <code>order</code> property set to a value of 2.");'
- text: '<code>#box-2</code>元素应该将<code>order</code>属性设置为值1。'
testString: 'assert($("#box-2").css("order") == "1", "The <code>#box-2</code> element should have the <code>order</code> property set to a value of 1.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box-container {
display: flex;
height: 500px;
}
#box-1 {
background-color: dodgerblue;
height: 200px;
width: 200px;
}
#box-2 {
background-color: orangered;
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'>
```js
// solution required
```
</section>