HTML basic tags


1) HTML heading tag

It is used to change the size of the text.


Syntax -

<h1>  </h1>

<h2>  </h2>

<h2>  </h2>

<h4>  </h4>

<h5>  </h5>

<h6>  </h6>

 

For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML heading tags</title>

</head>

<body>

    <h1>Heading 1</h1>

    <h2>Heading 2</h2>

    <h2>Heading 3</h2>

    <h4>Heading 4</h4>

    <h5>Heading 5</h5>

    <h6>Heading 6</h6>

</body>

</html>


Output

html heading tag

2) HTML paragraph tag 

It is used to define paragraph content in HTML document.


Syntax - 

<p>  </p>


 For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML paragraph tag</title>

</head>

<body>

  <p>This is paragraph tag in HTML</p>

</body>

</html>


Output

html paragraph tag

3) HTML line break tag

It is used to change the line.

This tag does not need a close tag.

 

Syntax - 

<br>


For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML line break tag</title>

</head>

<body>

    <p>Welcome to teknowize <br> this is line break tag </p>

</body>

</html>


Output

html line break tag

4) HTML horizontal line tag 

It is used to add a horizontal line.


Syntax -

<hr>

 

For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML horizontal line tag</title>

</head>

<body>

    <p>Welcome to teknowize</p>

    <hr>

    <p>Learn web development here</p>

    <hr>

</body>

</html>

 

Output

html horizontal line tag

5) HTML pre tag 

It is used to print same text which has two or more space or written in another line.


Syntax -

<pre>  </pre>

 

For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML pre tag</title>

</head>

<body>

    <pre> int x,y;.

        here int means integer type 

        x and y is a variable

               thank you 

        </pre>

        

</body>

</html>


Output

html pre tag

6) HTML center tag

It is used to move anything like text image, video, table etc at the middle.


Syntax -

<center>  </center>


For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML center tag</title>

</head>

<body>

    <center>

        <pre>    center tag is use to 

         move any thing like image,text, table etc 

               in middle of the screen </pre>

        </center>

</body>

</html>

 

Output

html center tag

7) HTML non-breaking space

It is used to put space in the same line without breaking the line.


Syntax - 

&nbsp;


For example

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML Non breaking space</title>

</head>

<body>

    <p>&nbsp;&nbsp;&nbsp; welcome &nbsp;&nbsp; to &nbsp;&nbsp; teknowize &nbsp;&nbsp;&nbsp; </p>

             

</body>

</html>


Output

html non breaking tag