简体   繁体   中英

W3C HTML validation errors: “Stray end tag </head>” and “Start tag <body> seen but an element of the same type was already open”

This part of the code, when validated by W3C validator, gives 2 errors:

  1. Stray end tag </head>

  2. Start tag <body> seen but an element of the same type was already open

<!DOCTYPE html>
<html lang="en"> 
    <head>
        <title> Chatter </title>
        <h1> Welcome to Chatter|app! </h1> 

        <style>
            body {
               background-color: #e0e0e0;}
        </style>

    </head>

    <body>

        <h4> #Food </h4>
        <h4> #Movies </h4>
        <h4> #SpaceX </h4>
        <h4> #Thingstodo </h4>
        <h4> #Chatter </h4>


        <input type= "button" value= "New" />
        <input type= "button" value= "Trending" />
        <input type= "button" value= "Favorites" />
    </body>
</html>

Just move the h1 element from head seaction to body section

<!DOCTYPE html>
<html lang="en">
<head>
    <title> Chatter </title>

    <style>
        body {
            background-color: #e0e0e0;
        }
    </style>

</head>
<body>
    <h1> Welcome to Chatter|app! </h1>

    <h4> #Food </h4>
    <h4> #Movies </h4>
    <h4> #SpaceX </h4>
    <h4> #Thingstodo </h4>
    <h4> #Chatter </h4>

    <input type="button" value="New" />
    <input type="button" value="Trending" />
    <input type="button" value="Favorites" />
</body>

</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM