关闭标签主体后的标签头 [英] Tag head after closing tab body

查看:30
本文介绍了关闭标签主体后的标签头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
是否可以在HTML中的结束标记</body> 后面插入< head> ?还是我必须在< head> 之前和< body> 之后进行编码?
我正在w3schools.com上阅读有关CSS的文章,并说:
注意:如果外部样式表的链接位于HTML的内部样式表之后,则外部样式表将覆盖内部样式床单!"
问题是,如果外部样式表在始终位于主体之前的头部中声明,那么如何将外部样式表放在内部样式表之后?

Hi everyone
is it possible, in HTML, to insert the <head> after the closing tag </body>? Or do I have to code before the <head> and after the <body>?
I was reading at w3schools.com about css, and it sais:
"Note: If the link to the external style sheet is placed after the internal style sheet in HTML , the external style sheet will override the internal style sheet!"
the question is how can I put and external style sheet after an internal style sheet if the external style sheet is declared in the head which is always before the body?

推荐答案

否.

HTML元素必须完全由一个HTML元素组成,其子元素依次为一个HEAD元素和一个BODY元素.

An HTML element must consist of exactly one HTML element with its children being one HEAD element and one BODY element, in that order.

所有这三个元素的开始和结束标记都是可选的,但您不能以其他任何顺序显式放置它们.

The start and end tags for all three of those elements are optional, but you can't explicitly place them in any other order.

如果将HEAD放在BODY之后,浏览器将尝试恢复错误,但是您不应该依赖于此.

Browsers will attempt error recovery if you place the HEAD after the BODY, but you shouldn't depend on this.

如果外部样式表在始终位于主体之前的头部中声明,则内部样式表之后的外部样式表?

external style sheet after an internal style sheet if the external style sheet is declared in the head which is always before the body?

您混淆了内部样式表(由< script> 元素定义,该元素(如用于外部样式表的< link> )必须出现在具有内联样式(由 style = 属性定义)的< head> ),该样式几乎可以出现在任何元素上,包括大多数出现在< body>中的元素; .

You are confusing internal stylesheets (defined with the <script> element, which (like <link> which is used for external stylesheets) must appear in the <head>) with inline styles (defined by the style= attribute, which can appear on almost any element, including most that appear in the <body>.

样式表出现的顺序不会改变内联样式的影响,因为样式表始终具有更高的特异性.

Nothing about the order that stylesheets appear in can alter the influence of inline style, since they will always have a higher specificity.

这篇关于关闭标签主体后的标签头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆