HTML – Headings and Paragraphs

Heading tags:

  • Heading tags are used to provide heading of page.
  • Web page recognized by the search engine using the heading tags and sub heading tags.
  • There is total 6 levels of heading tags h1, h2, h3…… h6
<!doctype html>
<html>
      <head>
                  <title> Heading tags </title>
      </head>
      <body>
                  <h1> Heading1 </h1>
                  <h2> Heading2 </h2>
                  <h3> Heading3 </h3>
                  <h4> Heading4 </h4>
                  <h5> Heading5 </h5>
                  <h6> Heading6 </h6>
      </body>
</html>

Headings with CSS:

<! DOCTYPE html>
<html>
            <head>
                        <title> Heading with CSS </title>
            </head>
            <body>
                        <h1 style=”color:red”> Heading1 </h1>
                        <h2 style=”color:green”> Heading2 </h2>
                        <h3 style=”color:blue”> Heading3 </h3>
            </body>
</html>

HTML Paragraph tag:

  • HTML paragraph is used to define a paragraph in a webpage.
  • If we are using various <p> tags in one HTML file then browser automatically adds a single blank line between the two paragraphs.
<!DOCTYPE html>
<html>
            <body>
                        <p>This is first paragraph.</p> 
                        <p>This is second paragraph.</p> 
                        <p>This is third paragraph.</p> 
            </body>
</html>

Headings and Paragraphs:

<! DOCTYPE html>
<html>
            <head>
                        <title> Heading and Paragraphs </title>
            </head>
            <body>
                        <h1 style=”color:red”> HTML </h1>
                        <h3 style=”color:blue”> HTML is used to create Web pages </h3>
                        <h1 style=”color:red”> CSS </h1>
                        <h3 style=”color:blue”> CSS is used apply styles to Web pages </h3>
                        <h1 style=”color:red”> JavaScript </h1>
                        <h3 style=”color:blue”> JavaScript used set functionality to web pages </h3>
            </body>
</html>

Apply style usings <style> tag:

<html>
            <head>
                        <title> Heading and Paragraphs </title>
                        <style>
                                    h1{
                                                color:red;
                                    }
                                    h3{
                                                color:green;
                                    }
                        </style>
            </head>
            <body>
                        <h1> HTML </h1>
                        <h3> HTML is used to create Web pages </h3>
                        <h1> CSS </h1>
                        <h3> CSS is used apply styles to Web pages </h3>
                        <h1> JavaScript </h1>
                        <h3> JavaScript is used provide functionality to web pages </h3>
            </body>
</html>
Scroll to Top