简体   繁体   English

杂散的结束标签“头”

[英]Stray end tag “head”

I have the following html5 code:我有以下 html5 代码:

<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 .代码在 html 标签内 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?我不明白这个错误的原因,我关闭了除meta和link之外的所有标签,无法关闭,有什么问题?

you need to understand -- the <head> element defines attributes that are used by the browser, but are not directly visible in the page.您需要了解—— <head>元素定义了浏览器使用的属性,但在页面中不直接可见。 The <title> attribute defines the title shown on your browser tab. <title>属性定义了在浏览器选项卡上显示的标题。

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.关闭<head>标签后,您应该打开<body>标签,页面中要显示的所有内容都应该在其中。

Also see http://reference.sitepoint.com/html/page-structure for a basic introduction to these elements.有关这些元素的基本介绍,另请参阅http://reference.sitepoint.com/html/page-structure

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

您需要在标题后关闭head标签并将您的内容包装在body标签中。

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然后会出现杂散的结束标记“head”,包括正文中的错误

If page opened in Chrome then it will add a > right after 'Body' tag如果页面在 Chrome 中打开,那么它会在“Body”标签之后添加一个 >

<body>
">"

In your code you have placed <p> inside <head> when the在您的代码中,您将<p>放在<head>

starts it indicates body part but so after开始它表示身体部位,但之后

all thing goes under body so closing </head> is an error所有的东西都在 body 下,所以关闭</head>是一个错误

这是你的字符集charset=UTF-8"它缺少"开头。

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 />注意链接标签最后以 /> 结尾

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM