1.8 KiB
1.8 KiB
id, challengeType, videoUrl, forumTopicId, title
id | challengeType | videoUrl | forumTopicId | title |
---|---|---|---|---|
587d78ae367417b2b2512afc | 0 | https://scrimba.com/p/pVaDAv/c2p78cg | 1301111 | 使用 flex-grow 属性扩展项目 |
Description
flex-shrink
相对的是flex-grow
。你应该还记得,flex-shrink
会在容器太小时对元素作出调整。相应地,flex-grow
会在容器太大时对元素作出调整。
例子与上一个挑战相似,如果一个项目的flex-grow
属性值为 1
,另一个项目的flex-grow
属性值为 3
,那么后者会较前者扩大 3 倍。
Instructions
#box-1
和#box-2
添加 CSS 属性flex-grow
,#box-1
的值设为 1
,#box-2
的值设为 2
。
Tests
tests:
- text: <code>#box-1</code>元素应有<code>flex-grow</code>属性,其值应为 <code>1</code>。
testString: assert($('#box-1').css('flex-grow') == '1');
- text: <code>#box-2</code>元素应有<code>flex-grow</code>属性,其值应为 <code>2</code>。
testString: assert($('#box-2').css('flex-grow') == '2');
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