Basic HTML Tags with Examples

Tags are the label to markup the beginning and end of the  HTML element. Tags are the keywords which help in displaying the HTML elements. Let us understand HTML in detail.

  HTML Tag features 

  • HTML Tags  should be enclosed between <> brackets.
  • Different HTML tags have different features.
  • There are two kinds of tags opening tags <> and closing tags</>.
  • Tags are used to differentiate between simple and HTML Tags.
  • The tags function is to specify when the HTML element ends.
  • Some Tags are unclosed. For eg; <br>.
  • HTML tags are case sensitive used in lower case.

 Syntax of HTML Tag 

 <tag> content </tag>
  • Opening of the  less than bracket with tag then closing of the greater than bracket , i.e start Tag .
  • Opening of the less than bracket and backslash with Tag then closing of the greater than bracket, i.e end Tag.

Use of Basic HTML Tags 

Eg 1. Heading Tags: It is used to define the heading of the HTML page. It organizes how the HTML data will display on the webpage.

<html>
 <body>
   <h1>hey there learner</h1>
   <h2>hey there learner</h2>
   <h3>hey there learner</h3>
   <h4>hey there learner</h4>
   <h5>hey there learner</h5>
   <h6>hey there learner</h6>
 </body>
</html>
 

 

    Output :  

Eg 2. Paragraph Tags:   It is used to define the block of text of an HTML element. It gives white space before and after the paragraph Automatically. 

<!DOCTYPE html>
<html>
<body>
 
<p>This is a paragraph.</p>
<p>  code dec  gives you an opportunity to learn programming from the scratch.</p>
<p>happy learning.</p>
 
</body>
</html>

 

  Output : 

Eg 3. Comment Tags:   It is used to comment on the source code for later explanation and editing. Comments are not displayed on the web browser.

<!-- This is a comment -->
<p>hello html.</p>

Output : 

Eg 4.  Line Break Tags:  It is denoted by character br  and open with less than the tag and forwarding slash and end with greater than tag <br/ >.It is used to break lines after the paragraph also known as unclosed tags. 

<!DOCTYPE html>
<html>
 
  <head>
     <title>Line Break  Example</title>
  </head>
  
  <body>
     <p>new assignment<br />
        have to submit today.<br />
        tuesday<br />
        2020</p>
  </body> 
</html>

  Output :