Problem: Error Stray End head Tag, Error body tag seen but an element of the same type was already open, Error stray start footer tag.
Question: Why am I getting these error? I've been looking through my book and can't figure it out.
<!Doctype html>
<html lang="eng">
<head>
<title>Josh Martin's INFO1311 Homepage</title>
<meta charset="utf-8">
<h1>Josh Martin's Info1311 Web Site</h1>
<h2>Fall 2022</h2>
</head>
<body>
<!-- Josh Martin
default.htm
INFO1311
Olberding
09/07/22
-->
<div>
<h3>Homework Assignments</h3>
<ul>
<li><a href="module2/assignment2.css"></a>Assignment 2</li>
<li>Assignment 3</li>
<li>Assignment 4</li>
<li>Assignment 5</li>
<li>Assignment 6</li>
<li>Assignment 7</li>
</ul>
<h3>Final Project Home Page</h3>
<h3>Important Links</h3>
<ul>
<li><a href="http://canvas.mccneb.edu">Canvas Course Web site</a> </li>
<li><a href="http://www.mccneb.edu">Metro Web site</a></li>
<li><a href="http://validator.w3.org">W3C (X)HTML Validator</a></li>
<li><a href="http://jigsaw.w3.org/css-validator/">W3C CSS Validator</a></li>
</ul>
</div>
</body>
<footer>
<p>Created by <a href=" [email protected]">Josh Martin</a></p>
</footer>
</html>
CodePudding user response:
The start and end tags for the head
, body
, and html
elements are optional.
If you include an element in the head
which isn't allowed there (such as h1
or h2
as you have done) then the head
will be implicitly closed and the body implicitly started.
This has a knock of effect of making the explicit end tag for head
and the start tag for body
and error.
Only put elements in the head
that are allowed there.
The only elements that are allowed to be children of html
are head
and body
. You can't put a footer
there, probably you meant it to be the last child of the body
element so it needs to go before the body
end tag.
CodePudding user response:
You can't put a footer
tag out of a body
tag section
<footer>
<p>Created by <a href=" [email protected]">Josh Martin</a></p>
</footer>
</body>
</html>
Instead -->
</body>
<footer>
<p>Created by <a href=" [email protected]">Josh Martin</a></p>
</footer>
</html>