HTML Basic Tags

Heading tag

  • By using <h1>,<h2>,<h3>,<h4>,<h5>,<h6> heading you can display different sizes of heading.
Program On Heading Tags
<!DOCTYPE html>
<html>
<head>
<title> Title Example</title>
</head>
<body>
<h1> Display Heading One</h1>
<h2> Display Heading Two </h2>
<h3> Display Heading Three </h3>
<h4> Display Heading Four </h4>
<h5> Display Heading Five </h5>
<h6> Display Heading Six </h6>
</body>
</html>
Output
Title Example

Display Heading One

Display Heading Two

Display Heading Three

Display Heading Four

Display Heading Five
Display Heading Six

 

Paragraph tag

  • By using <p> tag  you can display your content in different paragraphs.
Program On Paragraph Tags

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Third Paragraph</p>
</body>
</html>

Output

First Paragraph

Second Paragraph

Third Paragraph

Line Break tag

  • By using <br>tag you can break the line and start to next line.
Program On Line Break Tag

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>You can <br>break the line using <br> break Line tag</p>
</body>
</html>

Output

You can
break the line using
break Line tag

Centering Content

  •  <center> tag used to display content at the center of HTML document.
Program on Centering content

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>This text is at Leftside</p>
<center>
<p>This text is at center.</p>
</center>
</body>
</html>

Output

This text is at Leftside

This text is at center.

Horizontal Lines

  • By using <hr>tag you can break the line and creates margin in horizontal.
Program on Horizontal Lines
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>This is the text which <hr >shows working of horizontal lines </p>
</body>
</html>

Output

This is the text which


shows working of horizontal lines

Preserve Formatting

  • <pre>- It is used for pre-formatted text
Program on Preserve Formatting
<!DOCTYPE html>
<html>
<body>
<p>The pre tag displays as below:</p>
<pre>
Logical order can also apply </pre>
</body>
</html>
Output

The pre tag displays as below:

  Logical order can also apply 
  

Nonbreaking Spaces

  • &nbsp;- It is used to give spaces between different contents without breaking line.
Program on Nonbreaking Spaces

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>This is the &nbsp;example of &nbsp;nonbreaking spaces</p>
</body>
</html>

Output

This is the  example of  nonbreaking spaces

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *