1.7 KiB
1.7 KiB
id | challengeType | videoUrl | forumTopicId | title |
---|---|---|---|---|
bad87fee1348bd9aedf08823 | 0 | https://scrimba.com/c/cnpyGs3 | 16166 | 给元素添加负外边距 |
Description
margin(外边距)
控制元素border(边框)
与其他周围元素之间的距离大小。
如果你把元素的margin
设置为负值,元素会变得更大。
Instructions
margin
设为负值,跟红色框一样大小。
蓝色框的margin
设置为-15px
,它会填满与黄色框之间的距离。
Tests
tests:
- text: '<code>blue-box</code> class的<code>margin</code>应该设置为<code>-15px</code>。'
testString: assert($(".blue-box").css("margin-top") === "-15px");
Challenge Seed
<style>
.injected-text {
margin-bottom: -25px;
text-align: center;
}
.box {
border-style: solid;
border-color: black;
border-width: 5px;
text-align: center;
}
.yellow-box {
background-color: yellow;
padding: 10px;
}
.red-box {
background-color: crimson;
color: #fff;
padding: 20px;
margin: -15px;
}
.blue-box {
background-color: blue;
color: #fff;
padding: 20px;
margin: 20px;
}
</style>
<div class="box yellow-box">
<h5 class="box red-box">padding</h5>
<h5 class="box blue-box">padding</h5>
</div>
Solution
// solution required