2.0 KiB
2.0 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d78af367417b2b2512b00 | Use the align-self Property | 0 | 使用align-self属性 |
Description
align-self
。此属性允许您单独调整每个项目的对齐方式,而不是一次性设置它们。这很有用,因为使用CSS属性float
, clear
和vertical-align
其他常用调整技术对flex项不起作用。 align-self
接受与align-items
相同的值,并将覆盖align-items
属性设置的任何值。 Instructions
align-self
添加到#box-1
和#box-2
。给#box-1
一个中心值,给#box-2
一个flex-end值。 Tests
tests:
- text: '<code>#box-1</code>元素应将<code>align-self</code>属性设置为center的值。'
testString: 'assert($("#box-1").css("align-self") == "center", "The <code>#box-1</code> element should have the <code>align-self</code> property set to a value of center.");'
- text: '<code>#box-2</code>元素应该将<code>align-self</code>属性设置为flex-end的值。'
testString: 'assert($("#box-2").css("align-self") == "flex-end", "The <code>#box-2</code> element should have the <code>align-self</code> property set to a value of flex-end.");'
Challenge Seed
<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>
Solution
// solution required