2.1 KiB
2.1 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
bad88fee1348bd9aedf08825 | Adjust the Padding of an Element | 0 | https://scrimba.com/c/cED8ZC2 | 301083 | 调整元素的内边距 |
Description
padding(内边距)
,margin(外边距)
和border(边框)
。
padding
控制着元素内容与border
之间的空隙大小。
在这里,我们可以看到蓝色框和红色框都在黄色框里面。可以发现,红色框比蓝色框有着更多的padding
填充空间。
当你增加蓝色框的padding
值,文本内容与边框的距离会逐渐拉大。
Instructions
padding
的值要跟红色框的一样大小。
Tests
tests:
- text: '<code>blue-box</code> class 的<code>padding</code>值应为<code>20px</code>。'
testString: assert($(".blue-box").css("padding-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;
}
.blue-box {
background-color: blue;
color: #fff;
padding: 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