Stray end tag head как исправить

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?

asked Mar 12, 2013 at 17:16

Ramy Al Zuhouri's user avatar

Ramy Al ZuhouriRamy Al Zuhouri

21.5k26 gold badges104 silver badges187 bronze badges

0

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.

answered Mar 12, 2013 at 17:20

Nick Andriopoulos's user avatar

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

answered Mar 12, 2013 at 17:21

internals-in's user avatar

internals-ininternals-in

4,7382 gold badges21 silver badges38 bronze badges

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

answered Mar 12, 2013 at 17:18

user1936123's user avatar

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>
">"

answered Mar 9, 2014 at 12:15

panky sharma's user avatar

panky sharmapanky sharma

1,96927 silver badges45 bronze badges

In your code you have placed <p> inside <head> when the

starts it indicates body part but
so after

all thing goes under body so closing </head> is an error

answered Mar 12, 2013 at 17:30

Neophile's user avatar

NeophileNeophile

1,51912 silver badges15 bronze badges

This is your charset charset=UTF-8" it’s missing the " at the beginning.

MWiesner's user avatar

MWiesner

8,84811 gold badges36 silver badges70 bronze badges

answered Jan 20, 2016 at 17:41

Joel A Delphin's user avatar

1

i solved mine by doing this to my code i show you the tag example so you can see what i did to the tags.

so with a link tag it would be:

<link href='https://fonts.googleapis.com/css?family=Aclonica%7cPlayfair+Display' rel='stylesheet'/> 

notice on the end the link tag just ends with />

answered Dec 5, 2016 at 12:01

Makurious's user avatar

Прохожу курс на htmlacademy, пытаюсь отправить проект на защиту, но не пропускает автоматический валидатор, причем выдает ошибки, которых нет.
P.S. наставники уже не помогают.

1. Пишет, что не указана кодировка, хотя она указана как на странице, так и в атоме, в котором пишу. Везде utf-8.
Так же выдает, что этот тег не закрыт. Пробовал написать его так , все равно пишет, что не закрыт и еще дополнительную ошибку на этот символ.
Еще пишет Bad element name “meta-charset=»utf-8″”: Code point “U+003D” is not allowed

<!DOCTYPE html>
<html>
 <head>
 <meta-charset="utf-8">
  <title>Гостиницы</title>
  <link href="css/normalize.css" rel="stylesheet">
  <link rel="stylesheet" href="./css/index-css.css" type="text/css"/>
  <link href="https://fonts.googleapis.com/css?family=PT+Sans:400,700&amp;subset=cyrillic" rel="stylesheet">
 </head>
 <body>

2.Выдает ошибку в нескольких местах «Unmappable byte sequence: “81”. «. Что это означает понять не могу, первое слово вообще даже переводчик не берет.

3. Element “head” is missing a required instance of child element “title”. Так же не могу понять в чем ошибка, код выше.

4. Element “title” not allowed as child of element “meta-charset=»utf-8″” in this context.
Титульный элемент не допускается как дочерний к meta-charset.
Так же не понятно как исправить в связи с вопросами выше.

5. Stray end tag “head”. Переводчик перевел это как «шальное закрытие тега head. Это как понять? Код выше.

6. Start tag “body” seen but an element of the same type was already open. «Начальный тег body виден, но элемент того же типа уже открыт». Но у меня один на странице и он закрыт!

7. End tag for “body” seen, but there were unclosed elements. Говорит о незакрытых элементах, прошелся про каждому — нет незакрытых!

Подскажите как исправить данную ошибку? 
Error: Stray end tag head.From line 29, column 310; to line 29, column 316xt/css’ /></head><body

Да, ей там не место, все <div> должны находиться строго между <body> и </body>.

Большое спасибо, буду разбираться!

Дайте ссылку на проблемную страницу.

https://opticworld.com.ua/

там три ошибки выдаёт
Error: Stray end tag head.

From line 29, column 310; to line 29, column 316

xt/css’ /></head><body

Error: Start tag body seen but an element of the same type was already open.

From line 29, column 317; to line 29, column 355

/></head><body id=»index» class=»index lang_ru»> <span

Fatal Error: Cannot recover after last error. Any further errors will be ignored.

From line 29, column 317; to line 29, column 355

/></head><body id=»index» class=»index lang_ru»> <span

Хм, а Вас не смущает, что внутри <head></head> стоит <div>?

я в этом не разбираюсь, не могу сказать правильно это или нет, возможно ошибка в шаблоне

Ну, а как удалите, то будем Вам счастье — ещё 13 ошибок и пяток предупреждений по <body>

Ну тогда мокните фэйсом вашего программиста, который разбирается. Это косяк.

Благодарю, но сайтом занимаюсь сам, делаю как могу, изучаю по ходу проблем.
Вы имеете в виду <div class=»go-up» title=»Вверх» id=’ToTop’>⇧</div><div class=»go-down» title=»Вниз» id=’OnBottom’>⇩</div> эта часть проблемная?

For https://www.w3.org/WAI/demos/bad/before/home.html , I suspect it’s related to the <noscript> containing illegal children due to it being within the <head>. Probably that causes the parser to implicitly close the <noscript> tag early, thus making the explicit close </noscript> tag extraneous.

That is exactly the case. But it’s important to note that you’ll only see that behavior when scripting is disabled (as mentioned in the spec section you cited).

When scripting is not disabled — which of course in the normal case in web browsers — then the parser actually won’t implicitly close that noscript element. More specifically, when scripting is not disabled, the <B><FONT COLOR=RED>This page uses scripts!!!</FONT></B> inside the NOSCRIPT element in the source of https://www.w3.org/WAI/demos/bad/before/home.html just goes into the DOM as a text node.

But the checker is not capable of checking documents with scripting enabled. The checker doesn’t have a JavaScript engine to execute script with. So the checker uses the HTML parser in “scripting disabled” mode. And in “scripting disabled” mode, the parser doesn’t evaluate the NOSCRIPT content as text — instead the parser tries to parse any markup it finds inside the NOSCRIPT.

So exactly what happens here is that when the parser hits that <b> start tag, the parser inserts an implicit </noscript> end tag before the <b> start tag. But the parser doesn’t stop there; because the b element cannot appear in head, the parser also inserts both an implicit </head> end tag before the <b> start tag, and also inserts an implicit <body> start tag.

So with scripting disabled, this is what the parser ends up putting into the DOM:

Screen Shot 2019-07-19 at 11 16 10

…and this is what ends up getting rendered:

Screen Shot 2019-07-19 at 11 27 22

Hello all,

Im trying to resolve an issue with some HTML for my university work.

I am seeing the following errors when validating the HTML

«Error stray end tag ‘head’ »

and

«start tag ‘body’ seen but an element of the same type was already open»

i have been through the code and checked and i can only see one end tag for head and its after the ‘head’ content so i don’t know why its erroring.

as for the second error regarding body, i dont understand how it is already open as the body opens on line 9 and closes on 15.

am i missing something really simple?

I have added the HTML below. Can anyone help point me in the right direction?Please don’t just post the answer as i am really trying to learn this.

<!DOCTYPE html>
<html lang="en-gb">
  <head>
    <meta charset="utf-8">
    <title>Curtis Goddard, Apprentice</title>
    <img src="img/mmu-logo.jpg" alt="MMU logo">
      </head>
  
  <body>
<h1>Curtis G</h1>

<h2>Job Description</h2>
    <p>My current role involves learning about web development and how to implement HTML effectively.</p>

  </body>
</html>

Понравилась статья? Поделить с друзьями:
  • Как найти объем воздуха в баллоне
  • Как найти распределение электронов
  • Как найти свой mail в компьютере
  • Если на 41 счете минус как исправить
  • Как найти много денег срочно