本文介绍了头和身体之间的脚本元素。 [HTML5]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用W3C进行验证时,我收到了头部和身体之间的响应:
$ b

HTML5与常规XHTML验证相比具体如何?

HTML:
$ b

 < !doctype html> 
< html>
< head>
< meta charset =UTF-8>
< title>< / title>
< link href =services.css =stylesheettype =text / css>
< script>< / script>
< / head>
< body>

< div id =container>

< div id =header>
< / div>

< div id =body>
< / div>

< div id =footer>
< / div>

< / div>
< script>< / script>
< / body>
< / html>


解决方案

p>

您应该将它们放在头部或身体标签内。每次你都可以把它们放在身体的尽头。这是为了避免在下载脚本时阻止HTML呈现,从而提高网站响应速度。


When validating with W3C, I received the response:

How is this specific to HTML5 versus regular XHTML validation?

HTML:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="services.css" rel="stylesheet" type="text/css">
<script></script>
</head>
<body>

<div id="container">

  <div id="header">
  </div>

  <div id="body">
  </div>

  <div id="footer">
  </div>

</div>
<script></script>
</body>
</html>
解决方案

You placed your scripts on an invalid spot.

You should place them within head or body tags. Every time you can, put them at the end of the body. This is to avoid blocking html rendering while dowloading scripts, improving site responsiveness.

From w3.org

这篇关于头和身体之间的脚本元素。 [HTML5]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 00:21