Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Head tags are appearing inside body

Tags:

html

I have a simple web page, and a title, meta, etc in my page. But when I debug it with Firebug, Chrome and Firefox's default debugger, all my tags inside the head show up in the body.

This is all my code of index.html

<!DOCTYPE html>
<html>
<head>
    <title>TODO supply a title</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width"/>
    <link href="style.css" rel="stylesheet" />
</head>
<body>
    <canvas id="game"></canvas>

    <div id="mainmenu">
        <div id="title"></div>
        <a href="#" id="play" onclick="play()"></a>
        <!--<div id="ground"></div>-->
    </div>
    <script src="game.js"></script>
</body>
</html>

When I check the code in the debugger, all the elements inside the head tag are moved outside the head tag

enter image description here (sorry for my bad English)

like image 900
Chris Avatar asked Feb 08 '14 08:02

Chris


1 Answers

you should change encoding of your file to UTF-8

most of the times they all saved as UTF-8-BOM

open the file that your head tag is there with notepad++ then from encoding menu change "Encode in UTF-8-BOM" to "Encode in UTF-8" :)

like image 78
Matin Avatar answered Oct 30 '22 22:10

Matin