freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-mul...

2.5 KiB

id challengeType videoUrl forumTopicId title
587d781c367417b2b2512ac3 0 https://scrimba.com/c/crVWRHq 301069 设置多个标题元素的 font-weight

Description

在上一个挑战里你已经设置了每个标题的 font-size,接下来你将设置 font-weightfont-weight 属性用于设置文本中所用的字体的粗细。

Instructions

  • 设置 h1 标签的 font-weight 为 800。
  • 设置 h2 标签的 font-weight 为 600。
  • 设置 h3 标签的 font-weight 为 500。
  • 设置 h4 标签的 font-weight 为 400。
  • 设置 h5 标签的 font-weight 为 300。
  • 设置 h6 标签的 font-weight 为 200。

Tests

tests:
  - text: '你应该设置 <code>h1</code> 标签的 <code>font-weight</code> 为 800。'
    testString: assert($('h1').css('font-weight') == '800');
  - text: '你应该设置 <code>h2</code> 标签的 <code>font-weight</code> 为 600。'
    testString: assert($('h2').css('font-weight') == '600');
  - text: '你应该设置 <code>h3</code> 标签的 <code>font-weight</code> 为 500。'
    testString: assert($('h3').css('font-weight') == '500');
  - text: '你应该设置 <code>h4</code> 标签的 <code>font-weight</code> 为 400。'
    testString: assert($('h4').css('font-weight') == '400');
  - text: '你应该设置 <code>h5</code> 标签的 <code>font-weight</code> 为 300。'
    testString: assert($('h5').css('font-weight') == '300');
  - text: '你应该设置 <code>h6</code> 标签的 <code>font-weight</code> 为 200。'
    testString: assert($('h6').css('font-weight') == '200');

Challenge Seed

<style>
  h1 {
    font-size: 68px;
    
  }
  h2 {
    font-size: 52px;
    
  }
  h3 {
    font-size: 40px;
    
  }
  h4 {
    font-size: 32px;
    
  }
  h5 {
    font-size: 21px;
    
  }
  h6 {
    font-size: 14px;
    
  }
</style>
<h1>我是 h1 文字</h1>
<h2>我是 h2 文字</h2>
<h3>我是 h3 文字</h3>
<h4>我是 h4 文字</h4>
<h5>我是 h5 文字</h5>
<h6>我是 h6 文字</h6>

Solution

// solution required