2018-09-30 23:01:58 +01:00
---
id: 587d78ab367417b2b2512af0
title: 'Use display: flex to Position Two Boxes'
challengeType: 0
videoUrl: 'https://scrimba.com/p/pVaDAv/cgz3QS7'
2019-08-05 09:17:33 -07:00
forumTopicId: 301105
2018-09-30 23:01:58 +01:00
---
## Description
<section id='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 <code>display: flex;</code> on an element allows you to use other flex properties to build a responsive page.
</section>
## Instructions
<section id='instructions'>
2020-01-08 21:18:48 +09:00
Add the CSS property <code>display</code> to <code>#box -container</code> and set its value to <code>flex</code>.
2018-09-30 23:01:58 +01:00
</section>
## Tests
<section id='tests'>
```yml
2018-10-04 14:37:37 +01:00
tests:
2020-01-08 21:18:48 +09:00
- text: <code>#box -container</code> should have the <code>display</code> property set to a value of <code>flex</code>.
2019-07-24 03:54:35 -07:00
testString: assert($('#box -container').css('display') == 'flex');
2018-09-30 23:01:58 +01:00
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<style>
#box -container {
height: 500px;
2018-10-08 01:01:53 +01:00
2018-09-30 23:01:58 +01:00
}
2018-10-08 01:01:53 +01:00
2018-09-30 23:01:58 +01:00
#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'>
2019-04-20 11:45:18 -05:00
```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>
2018-09-30 23:01:58 +01:00
```
2019-07-18 08:24:12 -07:00
2018-09-30 23:01:58 +01:00
</section>