Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website HTML First Review: HTML First

When Creating code for a website, how do you tell the computer that your page is an html document

how do i tell the computer that my document is an html document

3 Answers

Marcel van der Hoek
Marcel van der Hoek
17,010 Points

Have you tried saving your file with an .html extension?

Jason Baxter
Jason Baxter
2,602 Points

Adding <!DOCTYPE html> at the beginning of the document as well as saving with a .html extension should do it. Can you describe the issue you are running into in more detail?

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Matt,

As Marcel has said, all the computer reads is the file extension to know what type of document it is, so .html will do it.

An example of this would be:

black.html black.png black.pdf black.doc

All of the above have the same name but with a different file extension, the computer does not look inside to know the type of file it is, it relies on the extension you have given it. Change the extension on one of your files and watch your computer try to open it in a different application because it thinks its now a different type of file.