[英]HTML5 Validation Errors
I have a bit of problem when trying to validate my page as HTML5. 尝试将我的页面验证为HTML5时,我遇到了一些问题。 There are two errors.
有两个错误。 The first says, 'Element head is missing a required instance of child element title', and the second error is, 'Element hr not allowed as child of element ul in this context.
第一个说,'元素头缺少必需的子元素标题实例',第二个错误是'元素hr不允许作为元素ul的子元素在此上下文中。 (Suppressing further errors from this subtree)'.
(抑制此子树的进一步错误)'。
Here is my source code 这是我的源代码
<!DOCTYPE html>
<html lang="en">
<head>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="core/css/style.css">
</head>
<body>
<nav>
<h1>Name</h1>
<ul>
<hr>
<li><a href=".."><img src="core/images/home.png" alt="Home"></a></li>
<hr>
<li><a href=".."><img src="core/images/about.png" alt="About"></a></li>
<hr>
<li><a href=".."><img src="core/images/projects.png" alt="Projects"></a></li>
<hr>
</ul>
</nav>
-Thank you in advance for any help -预先感谢您的任何帮助
As Juhana's comment points out the errors are self-explanatory: 正如Juhana的评论所指出的那样,错误是不言自明的:
Element head is missing a required instance of child element title
元素头缺少子元素标题的必需实例
This means you are simply missing a <title>
tag in your <head>
tags. 这意味着你只是在
<head>
标签中缺少<title>
<head>
标签。 You should definitely give your page a title! 你绝对应该给你的页面一个标题!
Element hr not allowed as child of element ul in this context
在此上下文中,元素hr不允许作为元素ul的子元素
By there very nature, <ul>
(unordered list) tags can only contain <li>
(list item) tags. 就其本质而言,
<ul>
(无序列表)标签只能包含<li>
(列表项)标签。 You are wrong to use a horizontal-rule inside your list. 在列表中使用水平规则是错误的。 You can achieve the same effect with CSS.
您可以使用CSS实现相同的效果。 I suggest read a few more tutorials on HTML and basic CSS.
我建议阅读一些关于HTML和基本CSS的教程。
I had the same problem with <hr>
tags inside an <ul>
. 我在
<ul>
<hr>
标签时遇到了同样的问题。 Instead of applying new css rules to your list you just have to contain <hr>
inside of a <li>
. 您只需在
<li>
包含<hr>
,而不是将新的css规则应用于列表。
<ul>
<li><hr/></li>
<li>text</li>
</ul>
Then all of your elements inside of a <ul>
are properly nested and contained. 然后,
<ul>
中的所有元素都被正确嵌套并包含在内。 No extra work necessary. 无需额外的工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.