Open In App

What are HTML Tags ?

Last Updated : 05 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

HTML (HyperText Markup Language) is the standard markup language used to create the structure and layout of web pages. HTML documents consist of a series of elements, and these elements are defined using HTML tags. HTML tags are essential building blocks that define the structure and content of a webpage. In this article, we’ll explore what HTML tags are, how they work, and provide detailed examples of common HTML tags.

Understanding HTML Tags

HTML tags are composed of an opening tag, content, and a closing tag. The opening tag marks the beginning of an element, and the closing tag marks the end. The content is the information or structure that falls between the opening and closing tags. Here’s the basic structure of an HTML tag:

<tagname> Content... </tagname>

Let’s delve into some commonly used HTML tags:

Tag Name

Description

<html> Tag

The <html> tag is the root element of an HTML document. It encapsulates the entire content of the page.

<head> Tag

The <head> tag contains meta-information about the HTML document, such as the title, links to stylesheets, and character set declaration.

<body> Tag

The <body> tag encloses the main content of the HTML document, including text, images, links, and other elements.

Heading Tags <h1> to <h6>

Heading tags are used to define headings in HTML, ranging from <h1> as the largest to <h6> as the smallest.

Paragraph Tag <p>

The <p> tag is used to define paragraphs of text.

Anchor Tag <a>

The <a> tag creates hyperlinks. The href attribute specifies the URL of the linked page.

Image Tag <img>

The <img> tag is used to embed images. The src attribute specifies the image file.

List Tags <ul>, <ol>, <li>

HTML supports both unordered lists (<ul>) and ordered lists (<ol>), with list items (<li>) defining each list item.

bold Tag <b>

The bold tag in HTML is used to specify the bold text without any extra importance.

Example 1: This example displaying the uses of heading and paragraph element.

HTML




<!DOCTYPE html>
<html>
    
<head>
    <title>HTML Tags example</title>  
</head>
  
<body>
    <h2>Welcome To GeeksforGeeks</h2>
    
    <p>A computer science portal for geeks.</p>
</body>
  
</html>


Output:

Example 2: This example describes the uses of <img> tag to display image on the screen.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>HTML Tags Example</title>
</head>
  
<body>
</body>
  
</html>


Output:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads