Creating Web Page with HTML

Two main tools are required to begin creating web pages with HTML. For writing and editing, we need a text editor and a web browser for page display and interactivity.

Text Editor: Text editors are a platform to write HTML commands. We can use any editor for editing HTML code. Visual Studio Code or Sublime Text are the best tools for this purpose.

Web Browser: The Web Browser’s principal role is to test or display website pages. Examples include Internet Explorer, Google Chrome, Microsoft Edge, etc.

Basic structure of an HTML Document.

<html>
    <head>
        
    </head>
    <body>
        
    </body>
</html>

In each HTML document, < HTML > and < /HTML > tags indicate the beginning and end of the document. These tags tell the browser that the document is an HTML file. We write all other HTML tags inside these tags.

We can split the HTML document into two sections:

  • Head Section
  • Body Section

Head Section: <head> and </head> tags identify the heading or title of the document. The tags <title> and </title> can appear only in this section. The text between these title tags appears as the title in the browser window. Its length must not be more than 60 characters.

Body Section: The body of an HTML document contains the data that appears on the site page. The body is enclosed within <body> and </body> tags. It describes the document’s format and structure. 

Example

The following HTML code displays a simple text on the web page.

<!DOCTYPE html>
<html>
<body>
    Hello, Learning Axis
</body>
</html>

Attributes

Some significant attributes of the <body> tag are as follows:

  • BGCOLOR: Used to specify the background color of the body tag.
  • BACKGROUND: It specifies the background picture of the web page.
  • TEXT: This specifies the color of the text present inside the body tag.

Example

<!DOCTYPE html>
<html>
<body text="yellow" bgcolor="red">
    Hello, Learning Axis
</body>
</html>

In the above example, the background color is red, and the text color is yellow. We can use a color hexadecimal code or color name as an attribute value.

<!DOCTYPE html>
<html>
<body backgground="Pic.png">
    Hello, Learning Axis
</body>
</html>

In the above example, “Pic.png” will appear in the background. It should be in the same directory as the web page. If the image is in another directory, we write the whole path of the picture in the attribute.

Watch Video on YouTube

How to create HTML Page?

Scroll to Top