freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/wrap-content-in-the-article...

3.4 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d774e367417b2b2512aa0 Wrap Content in the article Element 0 在文章元素中包装内容

Description

article是另一个新的HTML5元素它为您的标记添加了语义含义。 Article是一个sectioning元素用于包装独立的自包含的内容。该标记适用于博客条目论坛帖子或新闻文章。确定内容是否可以独立通常是一种判断调用但您可以使用几种简单的测试。问问自己是否删除了所有周围环境该内容是否仍然有意义类似地对于文本如果它在RSS提要中内容是否会保留请记住使用辅助技术的人们依赖于有组织的语义上有意义的标记来更好地理解您的工作。 关于sectiondiv注意事项
section元素也是HTML5的新元素article语义含义略有不同。 article适用于独立内容,一个section用于分组与主题相关的内容。根据需要,它们可以在彼此之间使用。例如,如果一本书是article ,那么每章都是一个section 。当内容组之间没有关系时,请使用div
<div> - 分组内容
<section> - 分组相关内容
<article> - 分组独立,自包含的内容

Instructions

Camper Cat使用article标签将帖子包装在他的博客页面上,但他忘了在最顶层的帖子中使用它们。更改div标签以改为使用article标签。

Tests

tests:
  - text: 您的代码应该有三个<code>article</code>标签。
    testString: 'assert($("article").length == 3, "Your code should have three <code>article</code> tags.");'
  - text: 您的代码不应包含任何<code>div</code>标记。
    testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");'

Challenge Seed

<h1>Deep Thoughts with Master Camper Cat</h1>
<main>
  <div>
    <h2>The Garfield Files: Lasagna as Training Fuel?</h2>
    <p>The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...</p>
  </div>

  <img src="samuraiSwords.jpeg" alt="">

  <article>
    <h2>Defeating your Foe: the Red Dot is Ours!</h2>
    <p>Felines the world over have been waging war on the most persistent of foes. This red nemesis combines both cunning stealth and lightening speed. But chin up, fellow fighters, our time for victory may soon be near...</p>
  </article>

  <img src="samuraiSwords.jpeg" alt="">

  <article>
    <h2>Is Chuck Norris a Cat Person?</h2>
    <p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p>
  </article>
</main>

Solution

// solution required