< head>在Chrome中显示为空 [英] <head> appears empty in Chrome

查看:201
本文介绍了< head>在Chrome中显示为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用最新版本的Google Chrome浏览我的网站,并使用F12查看源代码时,< head> < / head> 显示为空。

When browsing my website with last version of Google Chrome, and using F12 to look into the source, all the content between <head> and </head> appears empty. On last versions of Firefox and IE, everything appears correcyly.

实际上,内容会被移动到谷歌Chrome浏览器的主体中。

Actually the content is moved into the body on google Chrome.

这显然不是一个CSS问题。我使用Twitter Bootstrap CSS和JS,以及一个MVC PHP框架。有人有提示?

It's obviously not a CSS problem. I'm using Twitter Bootstrap CSS and JS, and a MVC PHP framework. Someone has a hint?

这是我的document.html页面:

Here is my document.html page:

<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<title><?php echo (Template::$titre); ?></title>

<?php foreach(Template::$meta as $key=>$value): ?>
        <meta name="<?php echo $key; ?>" content="<?php echo $value; ?>" />
<?php endforeach; ?>

<link rel="shortcut icon" href="<?php echo WEB; ?>assets/style/favicon.ico" type="image/x-icon" />  

<link rel="stylesheet" href="<?php echo WEB; ?>assets/style/bootstrap.min.css" />   
<link rel="stylesheet" href="<?php echo WEB; ?>assets/style/bootstrap-responsive.min.css" />    
<link rel="stylesheet" href="<?php echo WEB; ?>assets/style/main.css" />    
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head> 
<body>
<?php require Template::child(); ?>
(...)

由Firebug查看的源代码:

And the viewed source by Firebug:

<html lang="fr"><head></head><body>?


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>Veloccasion - Vélos d'occasion dans toute la France</title>
<meta name="keywords" content="velos d'occasion, velos dans toute la France, velos occasion Toute la france, velo occasion, velo">
<meta name="description" content="Petites annonces de velos d'occasion dans toute la France, velo d'occasion à vendre Toute la france">
<meta name="author" content="Veloccasion">

<link rel="shortcut icon" href="/assets/style/favicon.ico" type="image/x-icon"> 

<link rel="stylesheet" href="/assets/style/bootstrap.min.css">  
<link rel="stylesheet" href="/assets/style/bootstrap-responsive.min.css">   
<link rel="stylesheet" href="/assets/style/main.css">   
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->


<section id="maincontainer">
<div class="container">
(...)

编辑:问题解决,Notepad ++ UTF8,我改成ANSI并且工作正常。

推荐答案

在开始时你有某种格式的字符

You have some sort of malformed character at the start of your document.

我通过W3C验证器运行您的页面,并显示:

I ran your page through the W3C validator and it shows:


错误行1,列1:首先未查看
文件类型的情况下找到的非空格字符。预期<!DOCTYPE html>

http://validator.w3 .org / check?uri = http%3A%2F%2Fveloccasion.net%2F& charset =%28detect + automatically%29& doctype = Inline& group = 0

这似乎是导致Chrome删除您的doctype和渲染页面在怪异模式,你可以看到有趣的按钮和文本字段高度。尝试在DOCTYPE之前删除任何奇怪的东西(或删除DOCTYPE并重新键入它)

This appears to be causing Chrome to drop your doctype and render the page in Quirks mode, as you can see by the funny button and text field heights. Try deleting anything weird before the DOCTYPE (or removing the DOCTYPE and re-typing it)

这篇关于&lt; head&gt;在Chrome中显示为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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