How to create an HTML document

An html document is essentially just a text file with content, that also includes html elements. The example below shows a basic HTML file. The title will appear in the browser, and everything inside the body tag will appear in the browser window.

We need to save this file as an HTML file so that we can view and inspect our code in a browser.

Steps to create an HTML document using Visual Studio Code:

  1. Open Visual Studio Code
  2. Click “File” at the top left corner, and then “New Text File”
  3. Copy and paste the above code block into your newly created document and update any of the content inside the title, h1, or p tags
  4. Click “File” again, then “Save As…” and save your document with a relevant file name with the extension .html

After saving, you can open the file at any time with Visual Studio Code or another IDE and add more elements and content to your html document.

You can also open in a web browser to view your page!

Head on to the next lesson to show you how to build a website with html and css.

minimize add