HTML tags || Basic html tags

HTML Tags


Watch full Video about Basic html tags in Hindi:- Watch Now


Heading Tags (<h1>) :-

Any document starts with a heading. You can use different sizes for your headings. HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. While displaying any heading, the browser adds one line before and one line after that heading.

See The Example Below:-

Heading Example

This will produce the following Result:-

Heading Example result


Paragraph Tag (<p>) :-

The <p> tag offers a way to structure your text into different paragraphs. Each paragraph of text should go in between an opening <p> and a closing </p> tag as shown below in the example:

Paragraph example

This will produce the following result:

Paragraph example result


Line Break Tag(<br>) :-

Whenever you use the <br> element, anything following it starts from the next line. This tag is an example of an empty element, where you do not need opening and closing tags, as there is nothing to go in between them.

Example:-

Line Break example

This will produce the following result:

Line Break Example result


Centering Content (<center>):- 

You can use the <center> tag to put any content in the center of the page or any table cell.

Example:-

centring Content Example

This will produce the following result:

This text is not in the center of the page.
This text is in the center of the page.

 


Horizontal Lines(<hr>):-

Horizontal lines are used to visually break-up sections of a document. The <hr> tag creates a line from the current position in the document to the right margin and breaks the line accordingly.
For example, you may want to give a line between two paragraphs as in the given example below:

Example:-

Horizontal Lines example

This will produce the following result:

Horizontal Lines example result

Note:- Again <hr /> tag is an example of the empty element, where you do not need opening and closing tags, as there is nothing to go in between them.


Preserve Formatting (<pre>):-

Sometimes, you want your text to follow the exact format of how it is written in the HTML document. In these cases, you can use the preformatted tag <pre>.
Any text between the opening <pre> tag and the closing </pre> tag will preserve the formatting of the source document.

Example:-

Preserve Formatting example

This will produce the following result:

preserve Formatting Example result


Nonbreaking Spaces (&nbsp;):-

Suppose you want more than one white space between two wards on-page. You Should use the “&nbsp;” entity for white space. In cases, where you do not want the client browser to break text, you should use a nonbreaking space entity &nbsp; instead of a normal space.

For Example:-

<!DOCTYPE html>
<html>
     <head>
            <title>Nonbreaking Spaces Example</title>
     </head>
     <body>
             <p>This is an example of Nonbreaking &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; space </p>
      </body>
</html>

This will produce the following result:-

This is an example of Nonbreaking      space