没有P元素,但是看到了最终标签

发布于 2025-01-23 02:03:47 字数 2159 浏览 2 评论 0原文

我是编程的新手,最近才从HTML开始,当我试图创建一个示例网站并在验证器上进行检查。同样的计数,有人可以帮助我解决这个问题,以下是IAM的代码。

 <!DOCTYPE html>
    <html lang="en">
    <title>Pizza</title>
    <p><h1>My Favorite Pizza</h1></p>
    <p><h2>What is <em>Pizza</em>?</h2><a href="https://en.wikipedia.org/wiki/Pizza"></a>
    <p>a dish of Italian origin, consisting of a flat round base of dough baked with a topping of tomatoes and cheese, typically with added meat, fish, or vegetables.</p>
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Eq_it-na_pizza-margherita_sep2005_sml.jpg/330px-Eq_it-na_pizza-margherita_sep2005_sml.jpg" alt="Pizza">
    <p><h3>What are the types of Pizza?</h3></p>
    <ol>
    <li>Neapolitan Pizza.
    <li>Chicago Pizza.
    <li>New York-Style Pizza.
    <li> Sicilian Pizza.
    <li> Greek Pizza.
    <li>California Pizza.
    <li>Detroit Pizza.
    <li>St. Louis Pizza.
    </ol>
    <p><h3>examples of Pizza types</h3></p>
    <img src="https://image.shutterstock.com/image-photo/pizza-cheese-seafood-260nw-1099161842.jpg" alt="Meat Pizza">
    <img src="https://image.shutterstock.com/image-photo/pizza-ham-mozzarella-tomatoes-radicchio-260nw-1085673227.jpg" alt="Vegetables Pizza">
    <img src="https://image.shutterstock.com/image-photo/supreme-pizza-pepperoni-mushrooms-mozzarella-600w-1918786631.jpg" alt="Pepperoni Pizza">
    <p><h4>Common Places that sells pizza</h4></p>
    <p><a href= https://www.instagram.com/pizzastation.eg/>Pizza Station</a></p>
    <p><a href="https://www.egypt.pizzahut.me/en/home">Pizza Hut</a></p>
    <p><a href="https://www.dominos.com.eg/">Domions Pizza</a></p>
    <p><a href="https://www.papajohnsegypt.com/">Papa Johns</a></p>
    </body>
    
Also I made this on my own computer how can I have someone else able to view it?

I am new to programming, just started with HTML recently, and as I was trying to create a sample website and checking it on validator.w3c it gave me the above error, and I am pretty sure that all the start and end tags are exactly the same count, can someone please help me with this, below is the code iam doing.

 <!DOCTYPE html>
    <html lang="en">
    <title>Pizza</title>
    <p><h1>My Favorite Pizza</h1></p>
    <p><h2>What is <em>Pizza</em>?</h2><a href="https://en.wikipedia.org/wiki/Pizza"></a>
    <p>a dish of Italian origin, consisting of a flat round base of dough baked with a topping of tomatoes and cheese, typically with added meat, fish, or vegetables.</p>
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Eq_it-na_pizza-margherita_sep2005_sml.jpg/330px-Eq_it-na_pizza-margherita_sep2005_sml.jpg" alt="Pizza">
    <p><h3>What are the types of Pizza?</h3></p>
    <ol>
    <li>Neapolitan Pizza.
    <li>Chicago Pizza.
    <li>New York-Style Pizza.
    <li> Sicilian Pizza.
    <li> Greek Pizza.
    <li>California Pizza.
    <li>Detroit Pizza.
    <li>St. Louis Pizza.
    </ol>
    <p><h3>examples of Pizza types</h3></p>
    <img src="https://image.shutterstock.com/image-photo/pizza-cheese-seafood-260nw-1099161842.jpg" alt="Meat Pizza">
    <img src="https://image.shutterstock.com/image-photo/pizza-ham-mozzarella-tomatoes-radicchio-260nw-1085673227.jpg" alt="Vegetables Pizza">
    <img src="https://image.shutterstock.com/image-photo/supreme-pizza-pepperoni-mushrooms-mozzarella-600w-1918786631.jpg" alt="Pepperoni Pizza">
    <p><h4>Common Places that sells pizza</h4></p>
    <p><a href= https://www.instagram.com/pizzastation.eg/>Pizza Station</a></p>
    <p><a href="https://www.egypt.pizzahut.me/en/home">Pizza Hut</a></p>
    <p><a href="https://www.dominos.com.eg/">Domions Pizza</a></p>
    <p><a href="https://www.papajohnsegypt.com/">Papa Johns</a></p>
    </body>
    
Also I made this on my own computer how can I have someone else able to view it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

此生挚爱伱 2025-01-30 02:03:47

在下面尝试此代码。我已经格式化了它并修复了您的错误。

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Pizza</title>
  </head>
  <body>
    <h1>My Favorite Pizza</h1>
    <h2>What is <em>Pizza</em>?</h2>
    <a href="https://en.wikipedia.org/wiki/Pizza"></a>
    <p>
      a dish of Italian origin, consisting of a flat round base of dough baked
      with a topping of tomatoes and cheese, typically with added meat, fish, or
      vegetables.
    </p>
    <img
      src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Eq_it-na_pizza-margherita_sep2005_sml.jpg/330px-Eq_it-na_pizza-margherita_sep2005_sml.jpg"
      alt="Pizza"
    />
    <h3>What are the types of Pizza?</h3>
    <ol>
      <li>Neapolitan Pizza.</li>
      <li>Chicago Pizza.</li>
      <li>New York-Style Pizza.</li>
      <li>Sicilian Pizza.</li>
      <li>Greek Pizza.</li>
      <li>California Pizza.</li>
      <li>Detroit Pizza.</li>
      <li>St. Louis Pizza.</li>
    </ol>

    <h3>examples of Pizza types</h3>
    <img
      src="https://image.shutterstock.com/image-photo/pizza-cheese-seafood-260nw-1099161842.jpg"
      alt="Meat Pizza"
    />
    <img
      src="https://image.shutterstock.com/image-photo/pizza-ham-mozzarella-tomatoes-radicchio-260nw-1085673227.jpg"
      alt="Vegetables Pizza"
    />
    <img
      src="https://image.shutterstock.com/image-photo/supreme-pizza-pepperoni-mushrooms-mozzarella-600w-1918786631.jpg"
      alt="Pepperoni Pizza"
    />
    <h4>Common Places that sells pizza</h4>
    <p><a href="https://www.instagram.com/pizzastation.eg">Pizza Station</a></p>
    <p><a href="https://www.egypt.pizzahut.me/en/home">Pizza Hut</a></p>
    <p><a href="https://www.dominos.com.eg/">Domions Pizza</a></p>
    <p><a href="https://www.papajohnsegypt.com/">Papa Johns</a></p>
  </body>
</html>

<!-- Also I made this on my own computer how can I have someone else able to view it? -->

代码中的错误以及我如何修复它们:

  1. 您的标题标签(H1,H2等)不应嵌套在&lt; p&gt;标签中。在html中,&lt; p&gt;表示段落,并且将使字体大小16px成为您不希望在标题中的字体。我已经从所有标题中删除了&lt; p&gt;标签,因为它们不应该在那里。
  2. 在第24行上,您有以下代码:&lt; p&gt;&lt; a href = https://www.instagram.com/pizzastation.eg/>/&gt; /代码>。由于您忘记将URL放入引号上,因此它被认为是一个自结尾标签,因为它具有这种格式:&lt; tag /&gt; < /code>(带有A /之后的普通标签),这是自我关闭标签是什么样的。以下是一些示例:&lt; br /&gt; < /code>,&lt; meta /&gt; < /code>。我在URL周围添加了引号,以使其像普通的锚标签一样。
  3. 我将&lt; title&gt;放入&lt; head&gt;标签中。 HEAD标签应包含以下标签(如果您使用的话),而不是所有这些都必须具有):&lt; link&gt;&lt; title&gt;&lt; meta&gt;&lt; style&gt;&lt; script&gt;

等它可以到网络主机。 infinityfree 是一个不错的选择,但对于您的第一个网站来说可能会有些复杂。我建议 w3schools spaces

祝您好运,进一步学习HTML,您已经开始了,并且做得很好:)

Try this code below. I have formatted it and fixed the errors you had.

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Pizza</title>
  </head>
  <body>
    <h1>My Favorite Pizza</h1>
    <h2>What is <em>Pizza</em>?</h2>
    <a href="https://en.wikipedia.org/wiki/Pizza"></a>
    <p>
      a dish of Italian origin, consisting of a flat round base of dough baked
      with a topping of tomatoes and cheese, typically with added meat, fish, or
      vegetables.
    </p>
    <img
      src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Eq_it-na_pizza-margherita_sep2005_sml.jpg/330px-Eq_it-na_pizza-margherita_sep2005_sml.jpg"
      alt="Pizza"
    />
    <h3>What are the types of Pizza?</h3>
    <ol>
      <li>Neapolitan Pizza.</li>
      <li>Chicago Pizza.</li>
      <li>New York-Style Pizza.</li>
      <li>Sicilian Pizza.</li>
      <li>Greek Pizza.</li>
      <li>California Pizza.</li>
      <li>Detroit Pizza.</li>
      <li>St. Louis Pizza.</li>
    </ol>

    <h3>examples of Pizza types</h3>
    <img
      src="https://image.shutterstock.com/image-photo/pizza-cheese-seafood-260nw-1099161842.jpg"
      alt="Meat Pizza"
    />
    <img
      src="https://image.shutterstock.com/image-photo/pizza-ham-mozzarella-tomatoes-radicchio-260nw-1085673227.jpg"
      alt="Vegetables Pizza"
    />
    <img
      src="https://image.shutterstock.com/image-photo/supreme-pizza-pepperoni-mushrooms-mozzarella-600w-1918786631.jpg"
      alt="Pepperoni Pizza"
    />
    <h4>Common Places that sells pizza</h4>
    <p><a href="https://www.instagram.com/pizzastation.eg">Pizza Station</a></p>
    <p><a href="https://www.egypt.pizzahut.me/en/home">Pizza Hut</a></p>
    <p><a href="https://www.dominos.com.eg/">Domions Pizza</a></p>
    <p><a href="https://www.papajohnsegypt.com/">Papa Johns</a></p>
  </body>
</html>

<!-- Also I made this on my own computer how can I have someone else able to view it? -->

The errors in your code and how I fixed them:

  1. Your heading tags (h1, h2, etc) should not be nested inside <p> tags. In HTML, <p> means paragraph, and will make the font-size 16px, which you don't want in a heading. I have removed the <p> tags from all of your headings as they aren't supposed to be there.
  2. On line 24, you had the following code: <p><a href= https://www.instagram.com/pizzastation.eg/>Pizza Station</a></p>. Since you forgot to put the URL in quotation marks, it was considered a self closing tag because it had this format: <tag /> (a normal tag with a / after it), which is what self closing tags look like. Here are some examples: <br />, <meta />. I added quotation marks around the url so that it acts like a normal anchor tag.
  3. I put the <title> inside a <head> tag. The head tag should contain the following tags (if you're using them), not all of these are mandatory to have): <link>, <title>, <meta>, <style>, <script>, etc.

For others to view your website, you need to publish it to a web host. InfinityFree is a good one, but it could be a bit complicated for your first website. I would recommend W3Schools Spaces.

Good luck further learning HTML, you have started off well and are doing a good job :)

无边思念无边月 2025-01-30 02:03:47
<p><h2>What is <em>Pizza</em>?</h2><a href="https://en.wikipedia.org/wiki/Pizza"></a>

您没有

在这里关闭标签。
最后关闭

<p><h2>What is <em>Pizza</em>?</h2><a href="https://en.wikipedia.org/wiki/Pizza"></a>

you haven’t closed

tag here .
Close it in the end

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文