【发布时间】:2014-06-16 18:23:14
【问题描述】:
您好,我正在通过 w3c 验证器验证我的 HTML 代码。但它显示错误元素头缺少子元素标题的必需实例。
网址是 http://nitansh.fwd.wf/article/travel/best-all-inclusive-resorts-for-romance/3189783/
当标题出现在 html 正文的头部时
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Best all-inclusive resorts for romance- NowU
</title>
<link rel="stylesheet" href="/static/css/styles.css">
<link rel="stylesheet" href="/static/css/video-js.css">
<link rel="stylesheet" href="/static/css/font-awesome.min.css">
<link rel="stylesheet" media="print" href="/static/css/print.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
</script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js">
</script>
<![endif]-->
<link rel="stylesheet" href="/static/css/socialsharing.css">
<link rel="canonical" href="/article/travel/best-all-inclusive-resorts-for-romance/3189783/">
<meta name="description" content="Whether for a honeymoon, anniversary, or private escape, these resorts fit the romantic bill.">
<meta property="og:description" content="Whether for a honeymoon, anniversary, or private escape, these resorts fit the romantic bill.">
<meta name="twitter:card" value="Whether for a honeymoon, anniversary, or private escape, these resorts fit the romantic bill.">
<meta property="og:title" content="Best all-inclusive resorts for romance">
<meta property="og:type" content="article">
<meta property="og:url" content="http://nitansh.fwd.wf/article/travel/best-all-inclusive-resorts-for-romance/3189783/">
<meta property="og:image" content="http://www.gannett-cdn.com/media/USATODAY/USATODAY/2013/06/18/1371593281000-Earlyne-s-luggage-1306181810_3_4.jpg"></head>
【问题讨论】:
-
"当标题出现在头部" 你确定吗?
-
是的,您可以通过检查元素来检查。
-
发布你的代码的 head 部分
-
文档的
head中肯定有一个title元素。 -
@David Thomas:不——显然正在发生重定向。我猜 OP 正在尝试验证重定向的来源,其中 title 元素肯定是缺失的。
标签: javascript html title w3c-validation