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.

Well, 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.

HTML Tags and Elements

HTML is written in the form of HTML elements consisting of markup tags. These markup tags are the fundamental characteristic of HTML. Every markup tag is composed of a keyword, surrounded by angle brackets, like <html>, <head>, <body>, <title>, and so on.

HTML tags normally come in pairs like <html> and </html>. The first tag in a pair is often called the opening tag (or start tag), and the second tag is called the closing tag (or end tag).

An opening tag and a closing tag are identical, except a slash (/) after the opening angle bracket of the closing tag, to tell the browser that the command has been completed. In between these tags you can add headings, paragraphs of text, tables, forms, images, videos etc. For example, a paragraph, which is represented by the p element, would be written as:

<p>This is a paragraph.</p>

You will learn more about the HTML elements in upcoming chapter.


Your Feedback:

We would love to hear from you, please drop us a line.