2.5 KiB
2.5 KiB
id | title | challengeType | videoUrl |
---|---|---|---|
587d78ae367417b2b2512afd | Use the flex-basis Property to Set the Initial Size of an Item | 0 | https://scrimba.com/p/pVaDAv/c3d9nCa |
Description
flex-basis
property specifies the initial size of the item before CSS makes adjustments with flex-shrink
or flex-grow
.
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.
Instructions
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
.
Tests
tests:
- text: The <code>#box-1</code> element should have a <code>flex-basis</code> property.
testString: assert($('#box-1').css('flex-basis') != 'auto', 'The <code>#box-1</code> element should have a <code>flex-basis</code> property.');
- 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), 'The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.');
- text: The <code>#box-2</code> element should have the <code>flex-basis</code> property.
testString: assert($('#box-2').css('flex-basis') != 'auto', 'The <code>#box-2</code> element should have the <code>flex-basis</code> property.');
- 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), 'The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.');
Challenge Seed
<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>
Solution
// solution required