Hi all,

I am new to coding and I've been receiving the error message for Unexpected Token '<'. The problem seems to be located in the very first line in my <!DOCTYPE html>. I am not sure what I am doing incorrectly. I've checked settings, rewritten the code, etc. Help would be appreciated! I attached a link to a screenshot of what I am seeing on my desktop. I am using Visual Studio Code, Google Chrome, and am on a MAC(OS) Click Here

You have mismatched html tags. For example, you are not closing a tag you have opened, your elements are incorrectly nested, etc. Something is wrong. I’m not near a computer right now (on my phone) to check your html code.

It seems like you're having a problem with your HTML code. The error message you're getting, "Unexpected Token '<'", means there's something wrong in your code. It's probably not the first line with <!DOCTYPE html> causing the issue, but something else.

Here's a simple way to troubleshoot it:

Check for Mistakes: Look carefully for any mistakes or extra things in your code. Sometimes even a small typo can cause this problem.

Check How You Saved: Make sure you saved your file properly and with the right name. If it's an HTML file, it should end with .html.

Use a Good Browser: Try opening your code in a different browser, like Google Chrome. Sometimes the browser you're using can act strangely.

Ask for Help:
If you're still stuck, ask someone who knows a bit about coding to take a look. They might spot the problem quickly.
Remember, coding can be tricky at first, but don't worry. Mistakes happen to everyone, even experienced coders. Just take it step by step, and you'll figure it out!

If you have it on the first line, it is probably because there are 2 closing tags next to each other as in -
<<!DOCTYPE html> note the second '<'.

Remove this and the error will disappear, it happens sometime especially when you paste code and did not see the first '<'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.