HTML Heading

Heading

• 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

,

,

,

,

,
. • While displaying any heading, browser adds one line before and one line after that heading.
Example:

<h1>Heading 1</h1>


<h2>Heading 2</h2>


<h3>Heading 3</h3>


<h4>Heading 4</h4>


<h5>Heading 5</h5>

<h6>Heading 6</h6>

• The <p> tag offers a way to structure your text into different paragraphs.

• A paragraph always starts on a new line.

• Each paragraph of text should go in between an opening <p> and a closing </p> tag as shown below.

Example 1:

<p>This is a paragraph.</p>

<p>This is a paragraph.</p>

<p>This is a paragraph.</p>

Example 2:

<p>

  This paragraph contains a lot of lines in the source code, but the browser ignores it.

</p>

<p>

  This paragraph

  contains a lot of spaces in the source code,

  but the browser ignores it.

</p>

<p>

  The number of lines in a paragraph depends on the size of the browser window. If you resize

  the browser window, the number of lines in this paragraph will change.

</p>

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:

This is<br>a paragraph<br>with line breaks.

Horizontal Line: <hr>

• The <hr> tag defines a thematic break in an HTML page and is most often displayed as a horizontal line.

• The <hr> element is used to separate content (or define a change) in an HTML page. Horizontal lines are used to visually break-up sections of a document.

Example:

This is some text.


This is a heading