* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
83 lines
1.5 KiB
Markdown
83 lines
1.5 KiB
Markdown
---
|
|
id: 587d78ab367417b2b2512af0
|
|
title: 'Use display: flex to Position Two Boxes'
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/p/pVaDAv/cgz3QS7'
|
|
forumTopicId: 301105
|
|
dashedName: use-display-flex-to-position-two-boxes
|
|
---
|
|
|
|
# --description--
|
|
|
|
This section uses alternating challenge styles to show how to use CSS to position elements in a flexible way. First, a challenge will explain theory, then a practical challenge using a simple tweet component will apply the flexbox concept.
|
|
|
|
Placing the CSS property `display: flex;` on an element allows you to use other flex properties to build a responsive page.
|
|
|
|
# --instructions--
|
|
|
|
Add the CSS property `display` to `#box-container` and set its value to `flex`.
|
|
|
|
# --hints--
|
|
|
|
`#box-container` should have the `display` property set to a value of `flex`.
|
|
|
|
```js
|
|
assert($('#box-container').css('display') == 'flex');
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```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>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<style>
|
|
#box-container {
|
|
height: 500px;
|
|
display: flex;
|
|
}
|
|
|
|
#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>
|
|
```
|