Script Element Between Head and Body. [closed]

When validating with W3C, I received the response:

script element between head and body. [HTML5]

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>

Answers


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

The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document.


Need Your Help

Stuck with Java json exception

java json exception-handling

Background: Have collected tweets from the streaming api to a textfile and successfully parsed each line to my java objects using json.org library. Great.

Adding class on ng-click

css angularjs

I'm trying to use the arguments of an ng-click to add a class to the same element, but so far no luck.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.