The initial HTML page can be crafted by following these steps:
Step 1: Open the Text Editor
To proceed, it is necessary to launch a text editing application like Notepad or Notepad++ to begin coding in HTML. The image below displays a snapshot of the text editor (Notepad++) used for creating HTML code.
Step 2: Type the HTML code.
At this stage, it is essential to enter the HTML code into the designated text editor. The HTML code consists of multiple tags and always initiates with the opening HTML tag and concludes with the closing HTML tag.
Below is the block detailing the structure for generating an HTML page:
<HTML>
<HEAD>
<!-- The Head tag is used to create a title of web page, CSS syntax for a web page, and helps in written a JavaScript code. -->
</HEAD>
<BODY>
<!-- The Body tag is used to display the content on a web page, which is specified between the body tag. -->
</BODY>
</HTML> <!-- It is the opening tag of any HTML -->
In the syntax provided earlier, certain crucial tags or elements are utilized, as detailed below:
<HTML>: This is the initial tag in every HTML document.
<HEAD>: The Head tag is used to create a title of the web page, CSS syntax for a web page, and helps in written a JavaScript code The <head> must be closed before the opening of <body> tag.
The Body element is employed to exhibit the content or text on a webpage, which is defined within the body tags.
The closing tag in HTML signifies the end of a specific HTML element.
Illustration: The subsequent instance generates a basic HTML webpage for better comprehension:
<HTML> <!-- It is the opening tag of any HTML -->
<HEAD>
<!-- The Head tag is used to create a title of web page, CSS syntax for a web page, and helps in written a JavaScript code. -->
<title> <!-- This tag is used to display the title of the Web Page -->
Simple HTML Page
</title>
<script>
<!-- This tag helps in written the JavaScript Code -->
</script>
<style>. 2
/* This tag is used to create a Cascading Style Sheet for displaying the attractive web page. */
</style>
</HEAD>
<BODY>
<center> <!-- This tag align the text as center -->
Example
<!-- The Body tag is used to display the content on a web page which is specify between the body tag. -->
</center>
</BODY>
</HTML>
Step 3: Save the HTML code.
Once the entire HTML code has been entered, it must be saved in a directory with a .html extension. Saving the HTML file can be done effortlessly by selecting the File tab and choosing the Save As feature. Subsequently, the file name should be entered with the .html extension. The image below illustrates the process of saving the aforementioned HTML code in a text editor.
Step 4: Run the HTML file.
In the final stage, we need to execute an HTML file by opening it from the directory where it was saved. The file will be displayed in the default web browser. See the sample output below: