当我在W3C Validator上试用我的网站时,我有这个错误:
看到了标记头,但是相同类型的元素已经打开。
我尝试过很多东西:在没有BOM的情况下重新编码UTF-8,更改语法,输入和输出不同的元数据但它不能解决我的问题。
这是我的代码:
<?php if($_SERVER['REQUEST_URI'] == '/index.php') header('Location:/')?>
<!DOCTYPE html>
<html lang="fr">
<!-- Begin Cookie Consent plugin -->
<script type="text/javascript">
window.cookieconsent_options = {"message":"En poursuivant votre navigation sur ce site, vous acceptez l’utilisation de cookies pour réaliser des statistiques de visites","dismiss":"Accepter","learnMore":"Plus d'infos","link":"http://must-assurances.com/mentions-legales.php","theme":"light-bottom"};
</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js"></script>
<head>
<meta charset="UTF-8">
<title>MUST Assurances</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="Site internet de la SAS MUST"/>
<meta name="keywords" content="assurance, nautique, courtier"/>
<meta name="author" content="MUST Assurances"/>
<link rel="apple-touch-icon" sizes="57x57" href="img/favicon/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="img/favicon/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/favicon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/favicon/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/favicon/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/favicon/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/favicon/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/favicon/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="img/favicon/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/favicon/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/favicon/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/favicon/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="img/favicon/manifest.json">
<link rel="shortcut icon" href="img/favicon/favicon.ico">
<meta name="msapplication-TileImage" content="img/favicon/mstile-144x144.png">
<meta name="msapplication-config" content="img/favicon/browserconfig.xml">
<link rel="stylesheet" href="css/landio.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/animate.css">
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic%7CLato:400,100,100italic,300italic,400italic,300,700italic,900,900italic,700'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
</head>
<body class="animated fadeIn"></body>
你有什么想法吗?
答案 0 :(得分:3)
<head>
元素的开始标记是可选的。 <script>
元素不能是<html>
元素的子元素。
因此,<script type="text/javascript">
意味着<head>
元素的开头,因此当您明确键入<head>
时,您尝试打开<head>
而不是另一个<head>
是不允许的。
或者:
<head>
移至<script type="text/javascript">
或 <head>
开始代码。答案 1 :(得分:0)
脚本标签应位于头部或身体标签内