Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Invalid syntax on html?

Hello, my name is Grayson. I am a beginner coder who is twelve years old. I took this code from a website:

Code:
<!DOCTYPE Html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

And it put out this error:
File "C:\Users\grays\OneDrive\Desktop\Test.html", line 1
<!DOCTYPE Html>
^
SyntaxError: invalid syntax
[Finished in 156ms]

I have a text editor called sublime. And anyone that says I don't need the doctype command, the terminal says I do. I wonder if i need to do anything in the windows terminal. Please help.
 
Hello, my name is Grayson. I am a beginner coder who is twelve years old. I took this code from a website:

Code:
<!DOCTYPE Html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

And it put out this error:
File "C:\Users\grays\OneDrive\Desktop\Test.html", line 1
<!DOCTYPE Html>
^
SyntaxError: invalid syntax
[Finished in 156ms]

I have a text editor called sublime. And anyone that says I don't need the doctype command, the terminal says I do. I wonder if i need to do anything in the windows terminal. Please help.
Hey there,
So I tested your code, and everything seems alright. Whether you have the DOCTYPE command or not is not important, but one thing to note: the "H" in that command should be lowercase, or at least it will convert to lowercase once you preview it in a browser.
 
Hey there,
So I tested your code, and everything seems alright. Whether you have the DOCTYPE command or not is not important, but one thing to note: the "H" in that command should be lowercase, or at least it will convert to lowercase once you preview it in a browser.
Thanks for the feedback. But i think something is wrong with sublime. If you know sublime than you would know you have to enter a certain program into the build system (the program you use is the program you work with) I was wondering. Does html run on anything?
 
Thanks for the feedback. But i think something is wrong with sublime. If you know sublime than you would know you have to enter a certain program into the build system (the program you use is the program you work with) I was wondering. Does html run on anything?
As far as I am aware of, html will only render on a browser. If you were to open up a terminal/command prompt/powershell... and request a website, you are going to get all the text from the requested page, including html tags. As far as text editors (like sublime, notepad++) you have to manually open up the browser and refresh every time you make a change, IDE (integrated development environment) (like visual studio) on the other hand, will open up the browser by default and will reflect your changes.
 
Depending on the OS you are using (Mac , Linux or Windows) I prefer VS Code (Visual Studio Code) as it pairs up with Github and has more extensions available to it. Also, like @Antero360 stated, the H in HTML should be lowercase when declaring it in your !DOCTYPE statement. That could be the syntax error that your terminal is referring to.
 

New Threads

Buy us a coffee!

Back
Top Bottom