Feat: add new Markdown parser (#39800)

and change all the challenges to new `md` format.
This commit is contained in:
Oliver Eyton-Williams
2020-11-27 19:02:05 +01:00
committed by GitHub
parent a07f84c8ec
commit 0bd52f8bd1
2580 changed files with 113436 additions and 111979 deletions

View File

@ -6,45 +6,63 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c9W7MhM'
forumTopicId: 301100
---
## Description
<section id='description'>
To the right is the tweet embed that will be used as the practical example. Some of the elements would look better with a different layout. The last challenge demonstrated <code>display: flex</code>. Here you'll add it to several components in the tweet embed to start adjusting their positioning.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>display: flex</code> to all of the following items - note that the selectors are already set up in the CSS:
<code>header</code>, the header's <code>.profile-name</code>, the header's <code>.follow-btn</code>, the header's <code>h3</code> and <code>h4</code>, the <code>footer</code>, and the footer's <code>.stats</code>.
</section>
To the right is the tweet embed that will be used as the practical example. Some of the elements would look better with a different layout. The last challenge demonstrated `display: flex`. Here you'll add it to several components in the tweet embed to start adjusting their positioning.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: Your <code>header</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('header').css('display') == 'flex');
- text: Your <code>footer</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('footer').css('display') == 'flex');
- text: Your <code>h3</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('h3').css('display') == 'flex');
- text: Your <code>h4</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('h4').css('display') == 'flex');
- text: Your <code>.profile-name</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('.profile-name').css('display') == 'flex');
- text: Your <code>.follow-btn</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('.follow-btn').css('display') == 'flex');
- text: Your <code>.stats</code> should have a <code>display</code> property set to <code>flex</code>.
testString: assert($('.stats').css('display') == 'flex');
Add the CSS property `display: flex` to all of the following items - note that the selectors are already set up in the CSS:
`header`, the header's `.profile-name`, the header's `.follow-btn`, the header's `h3` and `h4`, the `footer`, and the footer's `.stats`.
# --hints--
Your `header` should have a `display` property set to `flex`.
```js
assert($('header').css('display') == 'flex');
```
</section>
Your `footer` should have a `display` property set to `flex`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert($('footer').css('display') == 'flex');
```
<div id='html-seed'>
Your `h3` should have a `display` property set to `flex`.
```js
assert($('h3').css('display') == 'flex');
```
Your `h4` should have a `display` property set to `flex`.
```js
assert($('h4').css('display') == 'flex');
```
Your `.profile-name` should have a `display` property set to `flex`.
```js
assert($('.profile-name').css('display') == 'flex');
```
Your `.follow-btn` should have a `display` property set to `flex`.
```js
assert($('.follow-btn').css('display') == 'flex');
```
Your `.stats` should have a `display` property set to `flex`.
```js
assert($('.stats').css('display') == 'flex');
```
# --seed--
## --seed-contents--
```html
<style>
@ -138,14 +156,7 @@ tests:
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -238,5 +249,3 @@ tests:
</div>
</footer>
```
</section>

View File

@ -6,37 +6,36 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c8aggtk'
forumTopicId: 301101
---
## Description
<section id='description'>
The <code>align-items</code> property is similar to <code>justify-content</code>. Recall that the <code>justify-content</code> property aligned flex items along the main axis. For rows, the main axis is a horizontal line and for columns it is a vertical line.
Flex containers also have a <strong>cross axis</strong> which is the opposite of the main axis. For rows, the cross axis is vertical and for columns, the cross axis is horizontal.
CSS offers the <code>align-items</code> property to align flex items along the cross axis. For a row, it tells CSS how to push the items in the entire row up or down within the container. And for a column, how to push all the items left or right within the container.
The different values available for <code>align-items</code> include:
# --description--
The `align-items` property is similar to `justify-content`. Recall that the `justify-content` property aligned flex items along the main axis. For rows, the main axis is a horizontal line and for columns it is a vertical line.
Flex containers also have a **cross axis** which is the opposite of the main axis. For rows, the cross axis is vertical and for columns, the cross axis is horizontal.
CSS offers the `align-items` property to align flex items along the cross axis. For a row, it tells CSS how to push the items in the entire row up or down within the container. And for a column, how to push all the items left or right within the container.
The different values available for `align-items` include:
<ul><li><code>flex-start</code>: aligns items to the start of the flex container. For rows, this aligns items to the top of the container. For columns, this aligns items to the left of the container.</li><li><code>flex-end</code>: aligns items to the end of the flex container. For rows, this aligns items to the bottom of the container. For columns, this aligns items to the right of the container.</li><li><code>center</code>: align items to the center. For rows, this vertically aligns items (equal space above and below the items). For columns, this horizontally aligns them (equal space to the left and right of the items).</li><li><code>stretch</code>: stretch the items to fill the flex container. For example, rows items are stretched to fill the flex container top-to-bottom. This is the default value if no <code>align-items</code> value is specified.</li><li><code>baseline</code>: align items to their baselines. Baseline is a text concept, think of it as the line that the letters sit on.</li></ul>
</section>
## Instructions
<section id='instructions'>
An example helps show this property in action. Add the CSS property <code>align-items</code> to the <code>#box-container</code> element, and give it a value of <code>center</code>.
<strong>Bonus</strong><br>Try the other options for the <code>align-items</code> property in the code editor to see their differences. But note that a value of <code>center</code> is the only one that will pass this challenge.
</section>
# --instructions--
## Tests
<section id='tests'>
An example helps show this property in action. Add the CSS property `align-items` to the `#box-container` element, and give it a value of `center`.
```yml
tests:
- text: The <code>#box-container</code> element should have an <code>align-items</code> property set to a value of <code>center</code>.
testString: assert($('#box-container').css('align-items') == 'center');
**Bonus**
Try the other options for the `align-items` property in the code editor to see their differences. But note that a value of `center` is the only one that will pass this challenge.
# --hints--
The `#box-container` element should have an `align-items` property set to a value of `center`.
```js
assert($('#box-container').css('align-items') == 'center');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -65,14 +64,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -100,5 +92,3 @@ tests:
<div id="box-2"><p>Goodbye</p></div>
</div>
```
</section>

View File

@ -6,38 +6,36 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c43gnHm'
forumTopicId: 301102
---
## Description
<section id='description'>
Sometimes the flex items within a flex container do not fill all the space in the container. It is common to want to tell CSS how to align and space out the flex items a certain way. Fortunately, the <code>justify-content</code> property has several options to do this. But first, there is some important terminology to understand before reviewing those options.
<a href="https://www.w3.org/TR/css-flexbox-1/images/flex-direction-terms.svg" target="_blank">Here is a useful image showing a row to illustrate the concepts below.</a>
Recall that setting a flex container as a row places the flex items side-by-side from left-to-right. A flex container set as a column places the flex items in a vertical stack from top-to-bottom. For each, the direction the flex items are arranged is called the <strong>main axis</strong>. For a row, this is a horizontal line that cuts through each item. And for a column, the main axis is a vertical line through the items.
There are several options for how to space the flex items along the line that is the main axis. One of the most commonly used is <code>justify-content: center;</code>, which aligns all the flex items to the center inside the flex container. Others options include:
# --description--
Sometimes the flex items within a flex container do not fill all the space in the container. It is common to want to tell CSS how to align and space out the flex items a certain way. Fortunately, the `justify-content` property has several options to do this. But first, there is some important terminology to understand before reviewing those options.
[Here is a useful image showing a row to illustrate the concepts below.](https://www.w3.org/TR/css-flexbox-1/images/flex-direction-terms.svg)
Recall that setting a flex container as a row places the flex items side-by-side from left-to-right. A flex container set as a column places the flex items in a vertical stack from top-to-bottom. For each, the direction the flex items are arranged is called the **main axis**. For a row, this is a horizontal line that cuts through each item. And for a column, the main axis is a vertical line through the items.
There are several options for how to space the flex items along the line that is the main axis. One of the most commonly used is `justify-content: center;`, which aligns all the flex items to the center inside the flex container. Others options include:
<ul><li><code>flex-start</code>: aligns items to the start of the flex container. For a row, this pushes the items to the left of the container. For a column, this pushes the items to the top of the container. This is the default alignment if no <code>justify-content</code> is specified.</li><li><code>flex-end</code>: aligns items to the end of the flex container. For a row, this pushes the items to the right of the container. For a column, this pushes the items to the bottom of the container.</li><li><code>space-between</code>: aligns items to the center of the main axis, with extra space placed between the items. The first and last items are pushed to the very edge of the flex container. For example, in a row the first item is against the left side of the container, the last item is against the right side of the container, then the remaining space is distributed evenly among the other items.</li><li><code>space-around</code>: similar to <code>space-between</code> but the first and last items are not locked to the edges of the container, the space is distributed around all the items with a half space on either end of the flex container.</li><li><code>space-evenly</code>: Distributes space evenly between the flex items with a full space at either end of the flex container</li></ul>
</section>
## Instructions
<section id='instructions'>
An example helps show this property in action. Add the CSS property <code>justify-content</code> to the <code>#box-container</code> element, and give it a value of <code>center</code>.
<strong>Bonus</strong><br>Try the other options for the <code>justify-content</code> property in the code editor to see their differences. But note that a value of <code>center</code> is the only one that will pass this challenge.
</section>
# --instructions--
## Tests
<section id='tests'>
An example helps show this property in action. Add the CSS property `justify-content` to the `#box-container` element, and give it a value of `center`.
```yml
tests:
- text: The <code>#box-container</code> element should have a <code>justify-content</code> property set to a value of <code>center</code>.
testString: assert($('#box-container').css('justify-content') == 'center');
**Bonus**
Try the other options for the `justify-content` property in the code editor to see their differences. But note that a value of `center` is the only one that will pass this challenge.
# --hints--
The `#box-container` element should have a `justify-content` property set to a value of `center`.
```js
assert($('#box-container').css('justify-content') == 'center');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -66,14 +64,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -101,5 +92,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,32 +6,25 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cnzdVC9'
forumTopicId: 301103
---
## Description
<section id='description'>
The tweet embed <code>header</code> and <code>footer</code> used the <code>flex-direction</code> property earlier with a row value. Similarly, the items inside the <code>.profile-name</code> element would work well stacked as a column.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>flex-direction</code> to the header's <code>.profile-name</code> element and set the value to column.
</section>
The tweet embed `header` and `footer` used the `flex-direction` property earlier with a row value. Similarly, the items inside the `.profile-name` element would work well stacked as a column.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: The <code>.profile-name</code> element should have a <code>flex-direction</code> property set to column.
testString: assert($('.profile-name').css('flex-direction') == 'column');
Add the CSS property `flex-direction` to the header's `.profile-name` element and set the value to column.
# --hints--
The `.profile-name` element should have a `flex-direction` property set to column.
```js
assert($('.profile-name').css('flex-direction') == 'column');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -124,14 +117,7 @@ tests:
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -223,5 +209,3 @@ tests:
</div>
</footer>
```
</section>

View File

@ -6,34 +6,31 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cJb8yuq'
forumTopicId: 301104
---
## Description
<section id='description'>
The <code>header</code> and <code>footer</code> in the tweet embed example have child items that could be arranged as rows using the <code>flex-direction</code> property. This tells CSS to align the children horizontally.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>flex-direction</code> to both the <code>header</code> and <code>footer</code> and set the value to row.
</section>
The `header` and `footer` in the tweet embed example have child items that could be arranged as rows using the `flex-direction` property. This tells CSS to align the children horizontally.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: The <code>header</code> should have a <code>flex-direction</code> property set to row.
testString: assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g));
- text: The <code>footer</code> should have a <code>flex-direction</code> property set to row.
testString: assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g));
Add the CSS property `flex-direction` to both the `header` and `footer` and set the value to row.
# --hints--
The `header` should have a `flex-direction` property set to row.
```js
assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g));
```
</section>
The `footer` should have a `flex-direction` property set to row.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g));
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -129,14 +126,7 @@ tests:
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -231,5 +221,3 @@ tests:
</div>
</footer>
```
</section>

View File

@ -6,33 +6,27 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cgz3QS7'
forumTopicId: 301105
---
## Description
<section id='description'>
# --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'>
Add the CSS property <code>display</code> to <code>#box-container</code> and set its value to <code>flex</code>.
</section>
Placing the CSS property `display: flex;` on an element allows you to use other flex properties to build a responsive page.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: <code>#box-container</code> should have the <code>display</code> property set to a value of <code>flex</code>.
testString: assert($('#box-container').css('display') == 'flex');
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');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -59,14 +53,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -92,5 +79,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,32 +6,25 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cd3PNfq'
forumTopicId: 301106
---
## Description
<section id='description'>
The last challenge introduced the <code>align-items</code> property and gave an example. This property can be applied to a few tweet embed elements to align the flex items inside them.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>align-items</code> to the header's <code>.follow-btn</code> element. Set the value to <code>center</code>.
</section>
The last challenge introduced the `align-items` property and gave an example. This property can be applied to a few tweet embed elements to align the flex items inside them.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: The <code>.follow-btn</code> element should have the <code>align-items</code> property set to a value of <code>center</code>.
testString: assert($('.follow-btn').css('align-items') == 'center');
Add the CSS property `align-items` to the header's `.follow-btn` element. Set the value to `center`.
# --hints--
The `.follow-btn` element should have the `align-items` property set to a value of `center`.
```js
assert($('.follow-btn').css('align-items') == 'center');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -126,14 +119,7 @@ tests:
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -227,5 +213,3 @@ tests:
</div>
</footer>
```
</section>

View File

@ -6,35 +6,33 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvzfv'
forumTopicId: 301107
---
## Description
<section id='description'>
The final property for flex items is <code>align-self</code>. This property allows you to adjust each item's alignment individually, instead of setting them all at once. This is useful since other common adjustment techniques using the CSS properties <code>float</code>, <code>clear</code>, and <code>vertical-align</code> do not work on flex items.
<code>align-self</code> accepts the same values as <code>align-items</code> and will override any value set by the <code>align-items</code> property.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>align-self</code> to both <code>#box-1</code> and <code>#box-2</code>. Give <code>#box-1</code> a value of <code>center</code> and give <code>#box-2</code> a value of <code>flex-end</code>.
</section>
The final property for flex items is `align-self`. This property allows you to adjust each item's alignment individually, instead of setting them all at once. This is useful since other common adjustment techniques using the CSS properties `float`, `clear`, and `vertical-align` do not work on flex items.
## Tests
<section id='tests'>
`align-self` accepts the same values as `align-items` and will override any value set by the `align-items` property.
```yml
tests:
- text: The <code>#box-1</code> element should have the <code>align-self</code> property set to a value of <code>center</code>.
testString: assert($('#box-1').css('align-self') == 'center');
- text: The <code>#box-2</code> element should have the <code>align-self</code> property set to a value of <code>flex-end</code>.
testString: assert($('#box-2').css('align-self') == 'flex-end');
# --instructions--
Add the CSS property `align-self` to both `#box-1` and `#box-2`. Give `#box-1` a value of `center` and give `#box-2` a value of `flex-end`.
# --hints--
The `#box-1` element should have the `align-self` property set to a value of `center`.
```js
assert($('#box-1').css('align-self') == 'center');
```
</section>
The `#box-2` element should have the `align-self` property set to a value of `flex-end`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert($('#box-2').css('align-self') == 'flex-end');
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -63,14 +61,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -98,5 +89,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,39 +6,45 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c3d9nCa'
forumTopicId: 301108
---
## Description
<section id='description'>
The <code>flex-basis</code> property specifies the initial size of the item before CSS makes adjustments with <code>flex-shrink</code> or <code>flex-grow</code>.
The units used by the <code>flex-basis</code> property are the same as other size properties (<code>px</code>, <code>em</code>, <code>%</code>, etc.). The value <code>auto</code> sizes items based on the content.
</section>
# --description--
## Instructions
<section id='instructions'>
Set the initial size of the boxes using <code>flex-basis</code>. Add the CSS property <code>flex-basis</code> to both <code>#box-1</code> and <code>#box-2</code>. Give <code>#box-1</code> a value of <code>10em</code> and <code>#box-2</code> a value of <code>20em</code>.
</section>
The `flex-basis` property specifies the initial size of the item before CSS makes adjustments with `flex-shrink` or `flex-grow`.
## Tests
<section id='tests'>
The units used by the `flex-basis` property are the same as other size properties (`px`, `em`, `%`, etc.). The value `auto` sizes items based on the content.
```yml
tests:
- text: The <code>#box-1</code> element should have a <code>flex-basis</code> property.
testString: assert($('#box-1').css('flex-basis') != 'auto');
- text: The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.
testString: assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g));
- text: The <code>#box-2</code> element should have the <code>flex-basis</code> property.
testString: assert($('#box-2').css('flex-basis') != 'auto');
- text: The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.
testString: assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g));
# --instructions--
Set the initial size of the boxes using `flex-basis`. Add the CSS property `flex-basis` to both `#box-1` and `#box-2`. Give `#box-1` a value of `10em` and `#box-2` a value of `20em`.
# --hints--
The `#box-1` element should have a `flex-basis` property.
```js
assert($('#box-1').css('flex-basis') != 'auto');
```
</section>
The `#box-1` element should have a `flex-basis` value of `10em`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g));
```
<div id='html-seed'>
The `#box-2` element should have the `flex-basis` property.
```js
assert($('#box-2').css('flex-basis') != 'auto');
```
The `#box-2` element should have a `flex-basis` value of `20em`.
```js
assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g));
```
# --seed--
## --seed-contents--
```html
<style>
@ -66,14 +72,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -100,5 +99,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,32 +6,25 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cZmWeA4'
forumTopicId: 301109
---
## Description
<section id='description'>
The last two challenges used the <code>flex-direction</code> property set to <code>row</code>. This property can also create a column by vertically stacking the children of a flex container.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>flex-direction</code> to the <code>#box-container</code> element, and give it a value of <code>column</code>.
</section>
The last two challenges used the `flex-direction` property set to `row`. This property can also create a column by vertically stacking the children of a flex container.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: The <code>#box-container</code> element should have a <code>flex-direction</code> property set to column.
testString: assert($('#box-container').css('flex-direction') == 'column');
Add the CSS property `flex-direction` to the `#box-container` element, and give it a value of `column`.
# --hints--
The `#box-container` element should have a `flex-direction` property set to column.
```js
assert($('#box-container').css('flex-direction') == 'column');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -59,14 +52,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -93,5 +79,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,34 +6,29 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cBEkbfJ'
forumTopicId: 301110
---
## Description
<section id='description'>
Adding <code>display: flex</code> to an element turns it into a flex container. This makes it possible to align any children of that element into rows or columns. You do this by adding the <code>flex-direction</code> property to the parent item and setting it to row or column. Creating a row will align the children horizontally, and creating a column will align the children vertically.
Other options for <code>flex-direction</code> are <code>row-reverse</code> and <code>column-reverse</code>.
<strong>Note:</strong> The default value for the <code>flex-direction</code> property is <code>row</code>.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>flex-direction</code> to the <code>#box-container</code> element, and give it a value of <code>row-reverse</code>.
</section>
Adding `display: flex` to an element turns it into a flex container. This makes it possible to align any children of that element into rows or columns. You do this by adding the `flex-direction` property to the parent item and setting it to row or column. Creating a row will align the children horizontally, and creating a column will align the children vertically.
## Tests
<section id='tests'>
Other options for `flex-direction` are `row-reverse` and `column-reverse`.
```yml
tests:
- text: The <code>#box-container</code> element should have a <code>flex-direction</code> property set to row-reverse.
testString: assert($('#box-container').css('flex-direction') == 'row-reverse');
**Note:** The default value for the `flex-direction` property is `row`.
# --instructions--
Add the CSS property `flex-direction` to the `#box-container` element, and give it a value of `row-reverse`.
# --hints--
The `#box-container` element should have a `flex-direction` property set to row-reverse.
```js
assert($('#box-container').css('flex-direction') == 'row-reverse');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -61,14 +56,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -95,5 +83,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,35 +6,33 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c2p78cg'
forumTopicId: 301111
---
## Description
<section id='description'>
The opposite of <code>flex-shrink</code> is the <code>flex-grow</code> property. Recall that <code>flex-shrink</code> controls the size of the items when the container shrinks. The <code>flex-grow</code> property controls the size of items when the parent container expands.
Using a similar example from the last challenge, if one item has a <code>flex-grow</code> value of <code>1</code> and the other has a <code>flex-grow</code> value of <code>3</code>, the one with the value of <code>3</code> will grow three times as much as the other.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>flex-grow</code> to both <code>#box-1</code> and <code>#box-2</code>. Give <code>#box-1</code> a value of <code>1</code> and <code>#box-2</code> a value of <code>2</code>.
</section>
The opposite of `flex-shrink` is the `flex-grow` property. Recall that `flex-shrink` controls the size of the items when the container shrinks. The `flex-grow` property controls the size of items when the parent container expands.
## Tests
<section id='tests'>
Using a similar example from the last challenge, if one item has a `flex-grow` value of `1` and the other has a `flex-grow` value of `3`, the one with the value of `3` will grow three times as much as the other.
```yml
tests:
- text: The <code>#box-1</code> element should have the <code>flex-grow</code> property set to a value of <code>1</code>.
testString: assert($('#box-1').css('flex-grow') == '1');
- text: The <code>#box-2</code> element should have the <code>flex-grow</code> property set to a value of <code>2</code>.
testString: assert($('#box-2').css('flex-grow') == '2');
# --instructions--
Add the CSS property `flex-grow` to both `#box-1` and `#box-2`. Give `#box-1` a value of `1` and `#box-2` a value of `2`.
# --hints--
The `#box-1` element should have the `flex-grow` property set to a value of `1`.
```js
assert($('#box-1').css('flex-grow') == '1');
```
</section>
The `#box-2` element should have the `flex-grow` property set to a value of `2`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert($('#box-2').css('flex-grow') == '2');
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -62,14 +60,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -96,5 +87,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,39 +6,51 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cbpW2tE'
forumTopicId: 301112
---
## Description
<section id='description'>
There is a shortcut available to set several flex properties at once. The <code>flex-grow</code>, <code>flex-shrink</code>, and <code>flex-basis</code> properties can all be set together by using the <code>flex</code> property.
For example, <code>flex: 1 0 10px;</code> will set the item to <code>flex-grow: 1;</code>, <code>flex-shrink: 0;</code>, and <code>flex-basis: 10px;</code>.
The default property settings are <code>flex: 0 1 auto;</code>.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>flex</code> to both <code>#box-1</code> and <code>#box-2</code>. Give <code>#box-1</code> the values so its <code>flex-grow</code> is <code>2</code>, its <code>flex-shrink</code> is <code>2</code>, and its <code>flex-basis</code> is <code>150px</code>. Give <code>#box-2</code> the values so its <code>flex-grow</code> is <code>1</code>, its <code>flex-shrink</code> is <code>1</code>, and its <code>flex-basis</code> is <code>150px</code>.
These values will cause <code>#box-1</code> to grow to fill the extra space at twice the rate of <code>#box-2</code> when the container is greater than 300px and shrink at twice the rate of <code>#box-2</code> when the container is less than 300px. 300px is the combined size of the <code>flex-basis</code> values of the two boxes.
</section>
There is a shortcut available to set several flex properties at once. The `flex-grow`, `flex-shrink`, and `flex-basis` properties can all be set together by using the `flex` property.
## Tests
<section id='tests'>
For example, `flex: 1 0 10px;` will set the item to `flex-grow: 1;`, `flex-shrink: 0;`, and `flex-basis: 10px;`.
```yml
tests:
- text: The <code>#box-1</code> element should have the <code>flex</code> property set to a value of <code>2 2 150px</code>.
testString: assert($('#box-1').css('flex-grow') == '2' && $('#box-1').css('flex-shrink') == '2' && $('#box-1').css('flex-basis') == '150px');
- text: The <code>#box-2</code> element should have the <code>flex</code> property set to a value of <code>1 1 150px</code>.
testString: assert($('#box-2').css('flex-grow') == '1' && $('#box-2').css('flex-shrink') == '1' && $('#box-2').css('flex-basis') == '150px');
- text: Your code should use the <code>flex</code> property for <code>#box-1</code> and <code>#box-2</code>.
testString: assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2);
The default property settings are `flex: 0 1 auto;`.
# --instructions--
Add the CSS property `flex` to both `#box-1` and `#box-2`. Give `#box-1` the values so its `flex-grow` is `2`, its `flex-shrink` is `2`, and its `flex-basis` is `150px`. Give `#box-2` the values so its `flex-grow` is `1`, its `flex-shrink` is `1`, and its `flex-basis` is `150px`.
These values will cause `#box-1` to grow to fill the extra space at twice the rate of `#box-2` when the container is greater than 300px and shrink at twice the rate of `#box-2` when the container is less than 300px. 300px is the combined size of the `flex-basis` values of the two boxes.
# --hints--
The `#box-1` element should have the `flex` property set to a value of `2 2 150px`.
```js
assert(
$('#box-1').css('flex-grow') == '2' &&
$('#box-1').css('flex-shrink') == '2' &&
$('#box-1').css('flex-basis') == '150px'
);
```
</section>
The `#box-2` element should have the `flex` property set to a value of `1 1 150px`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(
$('#box-2').css('flex-grow') == '1' &&
$('#box-2').css('flex-shrink') == '1' &&
$('#box-2').css('flex-basis') == '150px'
);
```
<div id='html-seed'>
Your code should use the `flex` property for `#box-1` and `#box-2`.
```js
assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2);
```
# --seed--
## --seed-contents--
```html
<style>
@ -65,14 +77,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -98,5 +103,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,36 +6,35 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cd3PBfr'
forumTopicId: 301113
---
## Description
<section id='description'>
# --description--
So far, all the properties in the challenges apply to the flex container (the parent of the flex items). However, there are several useful properties for the flex items.
The first is the <code>flex-shrink</code> property. When it's used, it allows an item to shrink if the flex container is too small. Items shrink when the width of the parent container is smaller than the combined widths of all the flex items within it.
The <code>flex-shrink</code> property takes numbers as values. The higher the number, the more it will shrink compared to the other items in the container. For example, if one item has a <code>flex-shrink</code> value of <code>1</code> and the other has a <code>flex-shrink</code> value of <code>3</code>, the one with the value of <code>3</code> will shrink three times as much as the other.
</section>
## Instructions
<section id='instructions'>
Add the CSS property <code>flex-shrink</code> to both <code>#box-1</code> and <code>#box-2</code>. Give <code>#box-1</code> a value of <code>1</code> and <code>#box-2</code> a value of <code>2</code>.
</section>
The first is the `flex-shrink` property. When it's used, it allows an item to shrink if the flex container is too small. Items shrink when the width of the parent container is smaller than the combined widths of all the flex items within it.
## Tests
<section id='tests'>
The `flex-shrink` property takes numbers as values. The higher the number, the more it will shrink compared to the other items in the container. For example, if one item has a `flex-shrink` value of `1` and the other has a `flex-shrink` value of `3`, the one with the value of `3` will shrink three times as much as the other.
```yml
tests:
- text: The <code>#box-1</code> element should have the <code>flex-shrink</code> property set to a value of <code>1</code>.
testString: assert($('#box-1').css('flex-shrink') == '1');
- text: The <code>#box-2</code> element should have the <code>flex-shrink</code> property set to a value of <code>2</code>.
testString: assert($('#box-2').css('flex-shrink') == '2');
# --instructions--
Add the CSS property `flex-shrink` to both `#box-1` and `#box-2`. Give `#box-1` a value of `1` and `#box-2` a value of `2`.
# --hints--
The `#box-1` element should have the `flex-shrink` property set to a value of `1`.
```js
assert($('#box-1').css('flex-shrink') == '1');
```
</section>
The `#box-2` element should have the `flex-shrink` property set to a value of `2`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert($('#box-2').css('flex-shrink') == '2');
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -64,14 +63,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -99,5 +91,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>

View File

@ -6,35 +6,31 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cQv9ZtG'
forumTopicId: 301114
---
## Description
<section id='description'>
# --description--
CSS flexbox has a feature to split a flex item into multiple rows (or columns). By default, a flex container will fit all flex items together. For example, a row will all be on one line.
However, using the <code>flex-wrap</code> property tells CSS to wrap items. This means extra items move into a new row or column. The break point of where the wrapping happens depends on the size of the items and the size of the container.
However, using the `flex-wrap` property tells CSS to wrap items. This means extra items move into a new row or column. The break point of where the wrapping happens depends on the size of the items and the size of the container.
CSS also has options for the direction of the wrap:
<ul><li><code>nowrap</code>: this is the default setting, and does not wrap items.</li><li><code>wrap</code>: wraps items from left-to-right if they are in a row, or top-to-bottom if they are in a column.</li><li><code>wrap-reverse</code>: wraps items from right-to-left if they are in a row, or bottom-to-top if they are in a column.</li></ul>
</section>
## Instructions
<section id='instructions'>
The current layout has too many boxes for one row. Add the CSS property <code>flex-wrap</code> to the <code>#box-container</code> element, and give it a value of <code>wrap</code>.
</section>
# --instructions--
## Tests
<section id='tests'>
The current layout has too many boxes for one row. Add the CSS property `flex-wrap` to the `#box-container` element, and give it a value of `wrap`.
```yml
tests:
- text: The <code>#box-container</code> element should have the <code>flex-wrap</code> property set to a value of <code>wrap</code>.
testString: assert($('#box-container').css('flex-wrap') == 'wrap');
# --hints--
The `#box-container` element should have the `flex-wrap` property set to a value of `wrap`.
```js
assert($('#box-container').css('flex-wrap') == 'wrap');
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -87,14 +83,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -146,5 +135,3 @@ tests:
<div id="box-6"></div>
</div>
```
</section>

View File

@ -6,32 +6,29 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c43GgTa'
forumTopicId: 301115
---
## Description
<section id='description'>
The last challenge showed an example of the <code>justify-content</code> property. For the tweet embed, this property can be applied to align the items in the <code>.profile-name</code> element.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>justify-content</code> to the header's <code>.profile-name</code> element and set the value to any of the options from the last challenge.
</section>
The last challenge showed an example of the `justify-content` property. For the tweet embed, this property can be applied to align the items in the `.profile-name` element.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: 'The <code>.profile-name</code> element should have the <code>justify-content</code> property set to any of these values: <code>center</code>, <code>flex-start</code>, <code>flex-end</code>, <code>space-between</code>, <code>space-around</code>, or <code>space-evenly</code>.'
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|space-evenly)\s*;/g));'
Add the CSS property `justify-content` to the header's `.profile-name` element and set the value to any of the options from the last challenge.
# --hints--
The `.profile-name` element should have the `justify-content` property set to any of these values: `center`, `flex-start`, `flex-end`, `space-between`, `space-around`, or `space-evenly`.
```js
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|space-evenly)\s*;/g
)
);
```
</section>
# --seed--
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
## --seed-contents--
```html
<style>
@ -125,14 +122,7 @@ tests:
</footer>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -225,5 +215,3 @@ tests:
</div>
</footer>
```
</section>

View File

@ -6,34 +6,31 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvNAG'
forumTopicId: 301116
---
## Description
<section id='description'>
The <code>order</code> property is used to tell CSS the order of how flex items appear in the flex container. By default, items will appear in the same order they come in the source HTML. The property takes numbers as values, and negative numbers can be used.
</section>
# --description--
## Instructions
<section id='instructions'>
Add the CSS property <code>order</code> to both <code>#box-1</code> and <code>#box-2</code>. Give <code>#box-1</code> a value of <code>2</code> and give <code>#box-2</code> a value of <code>1</code>.
</section>
The `order` property is used to tell CSS the order of how flex items appear in the flex container. By default, items will appear in the same order they come in the source HTML. The property takes numbers as values, and negative numbers can be used.
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: The <code>#box-1</code> element should have the <code>order</code> property set to a value of <code>2</code>.
testString: assert($('#box-1').css('order') == '2');
- text: The <code>#box-2</code> element should have the <code>order</code> property set to a value of <code>1</code>.
testString: assert($('#box-2').css('order') == '1');
Add the CSS property `order` to both `#box-1` and `#box-2`. Give `#box-1` a value of `2` and give `#box-2` a value of `1`.
# --hints--
The `#box-1` element should have the `order` property set to a value of `2`.
```js
assert($('#box-1').css('order') == '2');
```
</section>
The `#box-2` element should have the `order` property set to a value of `1`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert($('#box-2').css('order') == '1');
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -62,14 +59,7 @@ tests:
</div>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -97,5 +87,3 @@ tests:
<div id="box-2"></div>
</div>
```
</section>