Tulika Singh
Tulika Singh

Reputation: 21

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>

Upvotes: 1

Views: 1457

Answers (1)

Muhammed Albarmavi
Muhammed Albarmavi

Reputation: 24424

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>

Upvotes: 2

Related Questions