Updates
  • Starting New Weekday Batch for Full Stack Java Development on 27 September 2025 @ 03:00 PM to 06:00 PM
  • Starting New Weekday Batch for MERN Stack Development on 29 September 2025 @ 04:00 PM to 06:00 PM
Join Course

Basic HTML Tags

Heading Tag

• Heading tags (<h1> to <h6>) are used to create headings in HTML documents.
• <h1> represents the highest level heading, while <h6> represents the lowest level.
• Headings are used to structure and organize content, providing hierarchy and visual emphasis.
• Typically, <h1> is used for the main heading of a page or section, and lower-level headings are used for subheadings.
• Search engines and assistive technologies use headings to understand the content structure and provide better accessibility.
• It is important to use headings semantically, where <h1> is used once per page, and lower-level headings are used in proper order.

            
<!DOCTYPE html>
<html>
<head>
    <title>Heading Tag</title>
</head>
<body>
    <h1>This is First Heading</h1>
    <h2>This is Second Heading</h2>
    <h3>This is Third Heading</h3>
    <h4>This is Fourth Heading</h4>
    <h5>This is Fifth Heading</h5>
    <h6>This is sixth Heading</h6>
</body>
</html>
        

Paragraph Tag

• The paragraph tag in HTML is represented by <p> and is used to define a paragraph of text.
• It is used to group and format blocks of text in a webpage.
• The opening <p> tag indicates the start of a paragraph, and the closing </p> tag indicates the end.
• Paragraph tags automatically add spacing and create separate blocks of text.
• Multiple paragraphs can be used to organize and structure content on a webpage.

            
<!DOCTYPE html>
<html>
<head>
    <title>Paragraph Tag</title>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <p>This is First Paragraph</p>
</body>
</html>
        

Line Breaking Tag

• The line breaking tag <br> is used in HTML to create a line break within a paragraph or block of text.
• It is a self-closing tag and does not require a closing tag.
• When the <br> tag is used, it forces a line break at that point, moving the text or content to the next line.
• It is commonly used to separate lines of text or create spacing within a paragraph.
• Unlike paragraphs or headings, the <br> tag does not create a new block-level element, but simply adds a line break within an existing element.

            
<!DOCTYPE html>
<html>
<head>
    <title>Line Breaking Tag</title>
</head>
<body>
    <h1>Welcome to JTC</h1>

    <p>This is First Paragraph <br>
	This is example of Line Break.
    </p>
</body>
</html>
        

Link Tag

• The <a> tag in HTML is used for creating links to other web pages or resources.
• It stands for "anchor" and is also known as the "linking tag."
• The <a> tag requires an href attribute that specifies the destination of the link.
• When a user clicks on a link created with the <a> tag, they are redirected to the specified destination.
• The link text is placed between the opening and closing <a> tags, creating clickable text for the link.
• You can also create internal links by specifying the href attribute as a reference to an element's ID within the same page.

            
<!DOCTYPE html>
<html>
<head>
    <title>Link Tag</title>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <p>Hello Everyone</p>
    <a href="www.jtcindia.org">Click Here!!</a>
</body>
</html>
        

Horizontal Line tag

• The horizontal line tag <hr> is used in HTML to create a horizontal line or divider on a webpage.
• It is a self-closing tag and does not require a closing tag.
• The <hr> tag is commonly used to visually separate sections or content within a webpage.
• By default, it creates a horizontal line that spans the width of its container.
• The appearance of the line can be customized using CSS, such as changing its color, thickness, or style.
• The <hr> tag is a block-level element and can be placed between paragraphs, headings, or other HTML elements.
• It is not recommended to use the <hr> tag for purely decorative purposes, as it is primarily intended for structural division.

            
<!DOCTYPE html>
<html>
<head>
    <title>Link Tag</title>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <p>Hello Everyone</p>
    <a href="www.jtcindia.org">Click Here!!</a>
</body>
</html>
        

Preserve Formatting

• The <pre> tag in HTML is used to define preformatted text.
• It stands for "preformatted" and is used to display text exactly as it appears in the HTML code.
• The <pre> tag preserves white spaces, line breaks, and indentation within the text.
• It is commonly used for displaying code snippets, poetry, ASCII art, or any content that requires precise formatting.
• The text within the <pre> tag is typically displayed using a monospace font, which ensures consistent character spacing.
• The <pre> tag is a block-level element and automatically creates line breaks when necessary.

            
<!DOCTYPE html>
<html>
<head>
    <title>Preserve Formatting Tag</title>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <pre>
        function testfunction(JTC){
            alert (JTC)
        }
    </pre>
</body>
</html>
        

Preserve Formatting

• The <pre> tag in HTML is used to define preformatted text.
• It stands for "preformatted" and is used to display text exactly as it appears in the HTML code.
• The <pre> tag preserves white spaces, line breaks, and indentation within the text.
• It is commonly used for displaying code snippets, poetry, ASCII art, or any content that requires precise formatting.
• The text within the <pre> tag is typically displayed using a monospace font, which ensures consistent character spacing.
• The <pre> tag is a block-level element and automatically creates line breaks when necessary.

            
<!DOCTYPE html>
<html>
<head>
    <title>Preserve Formatting Tag</title>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <pre>
        function testfunction(JTC){
            alert (JTC)
        }
    </pre>
</body>
</html>
        

Nonbreaking spaces

• Nonbreaking spaces are used in HTML to insert spaces that prevent line breaks or automatic text wrapping.
• In HTML, the nonbreaking space is represented by the HTML entity &nbsp;.
• The &nbsp; entity can be used to create spaces between words or elements that should remain together without breaking.
• Nonbreaking spaces are particularly useful when you want to prevent a browser from automatically wrapping text at a certain point.
• They are commonly used in situations like keeping multiple words on the same line or maintaining spacing within a fixed-width element.
• Nonbreaking spaces are typically used when you need precise control over the formatting and spacing of text.

            
<!DOCTYPE html>
<html>
<head>
    <title>Nonbreaking Spaces</title>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <p>Hello Guys How are you??</p>
    <p>wel   come to Coding with JTC</p>
</body>
</html>