Stray end tag "head"

56,880

Solution 1

you need to understand -- the <head> element defines attributes that are used by the browser, but are not directly visible in the page. The <title> attribute defines the title shown on your browser tab.

After you close the <head> tag, you should open the <body> tag, in which all the content to be shown in the page should go.

Also see http://reference.sitepoint.com/html/page-structure for a basic introduction to these elements.

Solution 2

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="Style.css" rel="stylesheet" type="text/css"> 
    <title>Catalogo Dischi</title>

</head>

<body>

    <p class="title"> Catalogo Dischi </p>
    <a id="index">
        <p class="subtitle">Indice</p>
    </a>
    <p class="text">
        <a href="#classic">Musica Classica</a>
        <br/>
        <a href="#jazz">Musica Jazz</a>
        <br/>
        <a href="#country">Musica Country</a>
    </p>
</body>

Solution 3

You need to close the head tag after your title and wrap your content in body tags.

Solution 4

Error may occured if there is an issue of type or double tab in head section. suppose title is like this

    <title> Foundation </title>>

Then Stray end tag “head” will occur including error in body

If page opened in Chrome then it will add a > right after 'Body' tag

<body>
">"
Share:
56,880
Ramy Al Zuhouri
Author by

Ramy Al Zuhouri

iOS Developer in Haarlem - Noord Holland Netherlands

Updated on March 16, 2020

Comments

  • Ramy Al Zuhouri
    Ramy Al Zuhouri over 4 years

    I have the following html5 code:

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="Style.css" rel="stylesheet" type="text/css"> 
        <title>Catalogo Dischi</title>
            <p class="title"> Catalogo Dischi </p>
        <a id="index">
            <p class="subtitle">Indice</p>
        </a>
        <p class="text">
            <a href="#classic">Musica Classica</a>
            <br/>
            <a href="#jazz">Musica Jazz</a>
            <br/>
            <a href="#country">Musica Country</a>
        </p>
    </head>
    

    The code is inside the html tag. I don't understand the reason of this error, I close all tags except for meta and link, which can't be closed, what's the problem?

  • Flimm
    Flimm over 7 years
    I think this line is actually correct: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">