Stray end tag head. Help please, I'm quite a noob at coding. |
Stray end tag head. Help please, I'm quite a noob at coding. |
LightOfLight |
Nov 18 2020, 04:04 PM
Post
#1
|
Group: Members Posts: 1 Joined: 18-November 20 Member No.: 27,645 |
I am using https://validator.w3.org/ to check my html markup. And it shows this weird error. Does anyone know how to fix this?
(Stray end tag head.) & (Start tag body seen but an element of the same type was already open.) <!DOCTYPE html> <html lang="en"> <head> <title>Get Call Servicing</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="theme-color" content="#c9e0e04d"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="main.min.css"> <meta name="description" content="CallServicing"> <a rel="nofollow" href="https://www.facebook.com/">Facebook</a> <a class="main-header__nav-link" href="https://callservicing.com/dentist">Dentist</a> <a class="main-header__nav-link" href="https://callservicing.com/privacy2">Privacy Policy</a> <a class="main-header__nav-link" href="https://callservicing.com/termsofuse">Terms of Use</a> <a class="main-header__nav-link" href="https://callservicing.com/">Home</a> <ul id="nav-list"> <li> <a href="https://callservicing.com/privacy2"> Privacy Policy </a> </li> <li> <a href="https://callservicing.com/termsofuse"> Terms of Use </a> </li> <li> <a href="https://callservicing.com/dentist"> Dentist </a> </li> </ul> </head> <body> <header class="main-header"> <div class="container"> <div class="main-header__inner"> Attached thumbnail(s) |
pandy |
Nov 18 2020, 04:15 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
You've placed a lot of elements that belong in BODY in HEAD. All of this (I keep the closing HEAD tag).
CODE <a class="main-header__nav-link" href="https://callservicing.com/dentist">Dentist</a> <a class="main-header__nav-link" href="https://callservicing.com/privacy2">Privacy Policy</a> <a class="main-header__nav-link" href="https://callservicing.com/termsofuse">Terms of Use</a> <a class="main-header__nav-link" href="https://callservicing.com/">Home</a> <ul id="nav-list"> <li> <a href="https://callservicing.com/privacy2"> Privacy Policy </a> </li> <li> <a href="https://callservicing.com/termsofuse"> Terms of Use </a> </li> <li> <a href="https://callservicing.com/dentist"> Dentist </a> </li> </ul> </head> The BODY tags aren't mandatory to use. If they aren't used they are implied. Same with the HEAD tags. When it sees the first A tag above the validator assumes there are both a closing tag for HEAD and a start tag for BODY before it. Then when it comes to the the end tag for HEAD and start tag for BODY you actually typed, it reports them as erroneous. This may seem backwards, but the validator is just a machine. It takes it line for line. When it sees the A tag up in head it doesn't see an error, because HEAD and BODY tags can be implied. The error exists first when it encounters your closing tag for HEAD. It's often this way. The validator points out the point where the error i obvious to it, but the actual mistake can be much higher up in the HTML. One gets used to the validators way of "thinking" fairly quickly, because it's actually logical, even if that can be hard to see when one is new to it. Just place those links and the list where they belong and the errors will go away. |
Lo-Fi Version | Time is now: 17th April 2024 - 03:06 PM |