Build a Travel Agency Page - 构建一个旅行社页面

告诉我们发生了什么:

  1. 每个 figure 元素应包含一个锚元素作为其第一个子元素。
  2. 每个 figure 元素应包含一个 figcaption 元素作为其第一个子元素。
  3. 作为 figure 元素子元素的每个 a 元素都应该包含一个图像。

检查提示的25和26矛盾,请问该怎么编写?

到目前为止你的代码

<!DOCTYPE html>
<html lang="en">
 <head>
 <meta charset="UTF-8">
 <meta name="description" content="travels\group"> 
 <title>Travel Agency Page</title>
 </head>
 <body>
   <h1>Changchun city</h1>
<p>everyong,everytime,everywhere</p>
<h2>Packages</h2>
<p>By train</p>
<ul>
  <li><a href="https://www.freecodecamp.org/learn" target="_blank"/>Group Travels</a></li>
  <li><a href="https://www.freecodecamp.org/learn" target="_blank"/>Private Tours</a></li>
</ul>
<h2>Top Itineraries</h2>
<figure>
    <a href="https://www.freecodecamp.org/learn" target="_blank" ><figcaption><img src="https://cdn.freecodecamp.org/curriculum/labs/colosseo.jpg" alt="youchuan">
  youchuan
  </figcaption>
  </a>
  </figure>
 <figure>
  <figcaption>
    <a href="https://www.freecodecamp.org/learn" target="_blank" >
  youchuan
  </figcaption>
  <img src="https://cdn.freecodecamp.org/curriculum/labs/colosseo.jpg" alt="youchuan">
  </a>
  </figure> 
</body>
</html>

你的浏览器信息:

用户代理是: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0

挑战信息:

Build a Travel Agency Page - 构建一个旅行社页面

你好,问题出在你的 <figure> 元素结构上。你写成了这样:

<figure>
  <figcaption>
    <a href="https://www.freecodecamp.org/learn" target="_blank">
      youchuan
  </figcaption>
  <img src="https://cdn.freecodecamp.org/curriculum/labs/colosseo.jpg" alt="youchuan">
  </a>
</figure>

正确的结构应该是:

<figure>
  <a>
    <img>
  </a>
  <figcaption></figcaption>
</figure>

所以,问题就在于你组织 <figure> 元素的方式。在你的代码中,顺序是不正确的。请再仔细检查一下——<a> 标签应该包裹 <img>,而 <figcaption> 应该放在它后面,并且它们都必须位于 <figure> 元素内部。

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.