2.3 KiB
2.3 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf08822 | 要素のマージンを調整する | 0 | https://scrimba.com/c/cVJarHW | 16654 | adjust-the-margin-of-an-element |
--description--
要素の margin
は、要素の border
とその外側の要素の間のスペースを制御します。
ここでは、青い四角と赤い四角が黄色い四角の中に入れ子になっています。 赤い四角は青い四角より大きい margin
を持っており、そのため小さく表示されていることに注目してください。
青い四角の margin
を増やすと、その枠線と周囲の要素の間の距離が増えます。
--instructions--
青い四角の margin
が赤い四角と同じになるように変更してください。
--hints--
blue-box
クラスは、要素に 20px
の margin
を与える必要があります。
assert($('.blue-box').css('margin-top') === '20px');
--seed--
--seed-contents--
<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>
--solutions--
<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: 20px;
}
</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>