What is HTML

HTML stands for hypertext markup language where hypertext refers to the fact that HTML makes so that we can click on the links to move to another web page. The markup means the html tags that we use inside the text like bold tag, heading tag, etc. The language refers that HTML is a language as it has a syntax and written in certain code words. In the early nineties, Tim berners-lee developed the Hypertext markup language.

Is html a programming language?

HTML is not a programming language. The programming language is a language that performs some functionalities, but HTML does not perform any functionality. HTML does not contain any coding logic. It does not contain any conditional statements such as if/else, switch statement. It cannot perform any functionality that programming language does such as evaluating expressions, handling events. We cannot declare variables and functions. HTML is mainly used for providing structure to the web pages but not used for functional purposes.

HTML files

In a website, each web page is nothing but a html file only. Each html file is a plain-text file, but html file is saved with a .html extension instead of .txt extension. A html file consists of various html tags as well as the content written on a web page.

A single website contains many html files which are linked to each other. We can also edit the html file by using the editor. Everything we view on a web page is possible only through the HTML.

HTML tags

The HTML tags are the hidden keywords within a web page that describes how the content should look like on a web page. These tags contain two parts, i.e., opening and closing part. For example, <html> is an opening tag and </html> is a closing tag. The text of opening tag is same as the text of the closing tag except that the closing tag contains an additional forward slash character. Some tags do not require the closing tag like <img> tag does not require the closing tag </img>.

Each html file contains some essential tags which are required by the web browser to run the file and to display the content in a correct format. Other non-essential tags can be added based on the requirement of the developer.

HTML Document Structure

The above figure shows the structure of the HTML document. The first tag is <html> tag which contains all the other tags such as title tag, head tag, body tag. Only the content available in the <body> tag will be displayed on the web browser.

HTML Attributes

A HTML element can contain attributes that provide additional information about the HTML element. These attributes are available in a name/ value pair.

Let’s look at the simple example to understand the HTML attributes.

Program explanation

In the above program:

  • <!DOCTYPE html>: It defines that the html document belongs to the html5.
  • <html>: It is the most important or the root element for an html document.
  • lang: It is an attribute of the html element for defining the language for an html element. In the above example, we provide the “en” value to this attribute which means that the html document will use the English language.
  • <title>: The <title> tag is used for providing the title to the html page. In the above example, we provide the “Techiesbooks” as a title for our web page.
  • <body>: The <body> tag contains the content that we want to show on our web page.
  • <h1>: The content available within the <h1> tag will be a heading, and the size of the heading would be large.
  • <p>: The <p> tag is used to define the paragraph.

HTML headings

The HTML headings are used to define the title or the subtitle for a web page. It contains six levels of headings, i.e., h1, h2, h3, h4, h5, and h6. The h1 is the most important heading or it describes the main heading. The h6 is the least important heading.

Let’s understand through an example.


HTML Paragraphs

HTML paragraph is represented by <p> tag. HTML paragraphs describe a paragraph written between the starting tag <p> and the closing tag </p>. They are the block-level elements as they provide grouping of a related content in a block.

Let’s understand the <p> tag through an example.

HTML Links

The <a> tag is used to define a link. The links are always written between the starting tag <a> and the closing tag </a>. The <a> defines a attribute, i.e., href to create a link.

Let’s understand through an example.