Files
freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.chinese.md
2020-02-11 15:42:42 +09:00

2.1 KiB
Raw Blame History

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

我们先暂时把猫咪图片放在一边,让我们去学习更多 HTML 相关样式。 你可能已经注意到了,所有的 HTML 元素基本都是以矩形为基础。 每个 HTML 元素周围的矩形空间由三个重要的属性来控制: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