1.8 KiB
1.8 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
bad87fee1348bd9aedf08822 | Adjust the Margin of an Element | 0 | https://scrimba.com/c/cVJarHW | 16654 | 调整元素的外边距 |
Description
margin(外边距)
控制元素的边框与其他元素之间的距离。
在这里,我们可以看到蓝色框和红色框都在黄色框里。请注意,红色框的margin
值要比蓝色框的大,让它看起来比蓝色框要小。
当你增加蓝色的margin
值,它会增加元素边框到其他周围元素的距离。
Instructions
margin
的值要跟红色框的一样大小。
Tests
tests:
- text: '<code>blue-box</code> class 的<code>margin</code>值应为<code>20px</code>。'
testString: assert($(".blue-box").css("margin-top") === "20px");
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: 20px;
}
.blue-box {
background-color: blue;
color: #fff;
padding: 20px;
margin: 10px;
}
</style>
<h5 class="injected-text">margin</h5>
<div class="box yellow-box">
<h5 class="box red-box">padding</h5>
<h5 class="box blue-box">padding</h5>
</div>
Solution
// solution required