YoungGuy
YoungGuy

Reputation: 303

html validation fail

For a piece of homework, I cannot get this site to validate and I am not sure why? Here is the html:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <html>
    <head>
    <!--I am using TextWrangler to do my html css editing on my Mac-->
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title>
    KG Doors
    </title>
    </head>
    <body>
<div class="wrapper">  

<div class="masthead">
    <a href="http://www.notimefortime.com/index.thml"><img src="logo.jpeg"  alt="kgdoors" height="150"width="304"> </a>
</div><!--end the masthead div -->
<div id="nav-wrapper">
    <ul id="nav">
        <li><a href="index.html">Home</a></li>
        <li><a href="about.html">Services</a></li>
        <li><a href="contact.html">Contact</a></li>
    </ul>
</div><--end nav wrappe-->
<div class="body">
    <h1>Proudly Serving Chicago and Suburbs</h1>

</div><!--end the body div -->
<div class="footer">
    <h4>
        <br/>Educational site for DePaul University. 
        <br/><a href="http://www.kgdoors.com/">KG Doors</a>
    </h4>
</div><!--end the footer div -->

</div><!--end the wrapper div -->

    </body>
    </html>

Validation Output: 6 Errors

Line 4, Column 6: document type does not allow element "html" here ✉ The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Line 4, Column 1: Missing xmlns attribute for element html. The value should be: http://www.w3.org/1999/xhtml ✉ Many Document Types based on XML need a mandatory xmlns attribute on the root element. For example, the root element for XHTML might look like:

Line 7, Column 68: end tag for "meta" omitted, but OMITTAG NO was specified ✉ You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Line 7, Column 2: start tag was here Line 17, Column 114: end tag for "img" omitted, but OMITTAG NO was specified …om/index.thml"> ✉ You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Line 17, Column 55: start tag was here …p://www.notimefortime.com/index.thml"><--end nav wrappe--> ✉ This message may appear in several cases:

You tried to include the "<" character in your page: you should escape it as "<" You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe. Another possibility is that you forgot to close quotes in a previous tag. Line 40, Column 8: "html" not finished but document ended ✉ Line 40, Column 8: end tag for "html" omitted, but OMITTAG NO was specified ✉ You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Line 2, Column 1: start tag was here

Upvotes: 0

Views: 2789

Answers (3)

Avinash
Avinash

Reputation: 801

Have this validated code,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <!--I am using TextWrangler to do my html css editing on my Mac-->
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
            <link rel="stylesheet" type="text/css" href="style.css" />
            <title>
                KG Doors
            </title>
    </head>
    <body>
        <div class="wrapper">  

            <div class="masthead">
                <a href="http://www.notimefortime.com/index.thml"><img src="logo.jpeg"  alt="kgdoors" height="150" width="304" /> </a>
            </div><!--end the masthead div -->
            <div id="nav-wrapper">
                <ul id="nav">
                    <li><a href="index.html">Home</a></li>
                    <li><a href="about.html">Services</a></li>
                    <li><a href="contact.html">Contact</a></li>
                </ul>
            </div><!--end nav wrappe-->
            <div class="body">
                <h1>Proudly Serving Chicago and Suburbs</h1>

            </div><!--end the body div -->
            <div class="footer">
                <h4>
                    <br/>Educational site for DePaul University. 
                    <br/><a href="http://www.kgdoors.com/">KG Doors</a>
                </h4>
            </div><!--end the footer div -->

        </div><!--end the wrapper div -->

    </body>
</html>

Upvotes: 0

Raptor
Raptor

Reputation: 54260

  1. Remove the extra <html>
  2. Replace <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> with <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  3. In line </div><--end nav wrappe-->, an ! is missing

Upvotes: 1

mrtsherman
mrtsherman

Reputation: 39892

The big problem is that you declare <html> twice in your first three lines of code. Only declare this one time per page. That leaves two errors that have to deal with closing tags. Just google the w3c validation service's error message and I guarantee you will find explanations for them all.

Upvotes: 1

Related Questions