* 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>
93 lines
1.9 KiB
Markdown
93 lines
1.9 KiB
Markdown
---
|
|
id: 587d78af367417b2b2512b00
|
|
title: Use the align-self Property
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvzfv'
|
|
forumTopicId: 301107
|
|
dashedName: use-the-align-self-property
|
|
---
|
|
|
|
# --description--
|
|
|
|
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.
|
|
|
|
`align-self` accepts the same values as `align-items` and will override any value set by the `align-items` property.
|
|
|
|
# --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');
|
|
```
|
|
|
|
The `#box-2` element should have the `align-self` property set to a value of `flex-end`.
|
|
|
|
```js
|
|
assert($('#box-2').css('align-self') == 'flex-end');
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```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>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<style>
|
|
#box-container {
|
|
display: flex;
|
|
height: 500px;
|
|
}
|
|
#box-1 {
|
|
background-color: dodgerblue;
|
|
align-self: center;
|
|
height: 200px;
|
|
width: 200px;
|
|
}
|
|
|
|
#box-2 {
|
|
background-color: orangered;
|
|
align-self: flex-end;
|
|
height: 200px;
|
|
width: 200px;
|
|
}
|
|
</style>
|
|
|
|
<div id="box-container">
|
|
<div id="box-1"></div>
|
|
<div id="box-2"></div>
|
|
</div>
|
|
```
|