0

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?

2 Answers 2

1

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 :)

1
0
<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

Not the answer you're looking for? Browse other questions tagged or ask your own question.