HTML Basic

In this chapter, we will learn how to show some basic HTML examples.

HTML Document

In HTML, all documents must start with a document type declaration.

In HTML the document itself begins with <html> and ends with </html> and another part of the HTML document is between <body> and </body>.

Try Now

The <!DOCTYPE> Declaration

In HTML <!DOCTYPE> the declaration represents the document type and It helps the browser to display web pages correctly.

It declares only one time at the top of the page (before the HTML tags).

It is not case sensitive In the HTML5 version, we declare <!DOCTYPE> but we cannot declare before version of HTML5 ( HTML4, HTML3 and below ).

HTML Headings

HTML heading are defined with <h1> to <h6> tag.

The most important heading is <h1> and <h6> is the least important heading.

Try Now

HTML Paragraphs

HTML paragraph is defined with the <p> tag.

Try Now

HTML Links

In HTML link are defined with the <a> tag. You have to put the path of the link inside href. The href is an attribute. Attributes tell us additional information about HTML. We will learn more about attributes in a later chapter.

Try Now

HTML Images

In HTML images are defined with <img> tag.

Try Now

In the given above example the source file (src), alternative text (alt ), width and height are also attributes.

Note:  The alt tag is helpful when the image is not found then the alt tag name shown in the browser. If the image is found then the alt tag name is not shown in the browser.

HTML Line Break In HTML the line break tag is used for the next line or break new line. It is an empty element that means there is no need to open and closing the tag.


Try Now

Horizontal Lines

In HTML the horizontal line tag <hr>is used to break up the section of the document. It creates a line from the current position.


Try Now

How to view HTML Source code?

It is an interesting thing when you run your HTML code then you can see the result in the browser but if you want to see the source code of HTML then just right click and go to the inspect option you can see the source code.

You can also edit your HTML code and see their result in the browser.

It is very important to inspect HTML code. When you create a project then it will help you so much.

There are many tags we will learn in the next chapter.