HTML Get Started

An HTML file is simply a text file saved with an .html or .htm extension (i.e. as opposed to a .txt extension).

Getting Started

Here, you will learn how easy it is to create an HTML document (i.e. a web page). To begin coding HTML you need only two stuff: a simple-text editor and a web browser.

OK, let's get straight into it.

Creating Your First HTML Document

Let's walk through the following steps. At the end of the tutorial, you will have made an HTML file that displays "Hello world" message in your web browser.

Step 1: Creating the HTML file

Open up your computer's plain text editor and create a new file.

 

Tip:We suggest you to use only the simplest text editors such as Notepad (under Windows), TextEdit (on the Mac). Once you understand the basic principles, you may switch to more advanced tools such as Dreamweaver.

Step 2: Type some HTML code

Start with an empty window and type the following code:

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  •     <title>A simple HTML document</title>
  • </head>
  • <body>
  •     <p>Hello World!<p>
  • </body>
  • </html>

Step 3: Saving the file

Now save the file on your desktop as "myfirstpage.html ".

 

Note:It is important that the extension .html is specified — some text editors, such as Notepad, will automatically save it as .txt otherwise.

To open the file in a browser. Navigate to your file then double click on it. It will open in your default Web browser. (If it does not, open your browser and drag the file to it.)

Explanation of code

You might think what that code was all about. OK, let's get straight into it.

  • DOCTYPE declaration — A line defines the HTML5 document type.
  • A declarative header section (enclosed by the HEAD element) — Provides information about the document, including its title, style information, and scripts.
  • A document body (enclosed by the BODY element) — Contains the document's actual content that is rendered in the web browser and displayed to the user.

You will learn about the various elements of the HTML document in the coming lessons. We suggest you experiment with everything you learn here.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.