Style Tags in HTML 5

Style tags in HTML 5

  •  <b>:- This tag is used to display a text in  
     bold in html document.

            Syntax:

           
<b> Text you want to display in bold </b>

          Code:

            <!DOCTYPE HTML>
          <html>
          <body>
          <p> I m <b> b </b> tag </p>
          </body>
          </html>
            
          Output:

             b.gif
          

      

  •  <i>:- This tag is used to show text in italics in a document.
     
     Syntax:

     
    <i> Text you  want to show in italics </i>

         Code:

           <!DOCTYPE HTML>
         <html>
         <body>
         <p> I m <i> i </i> tag </p>
         </body>
         </html>
       
         Output:

            i.gif 
 

  •  <pre>:- This tag is used to set formatting in such a way, that the way 
     we write it, it will display in browser in same format. It will also include  white space if you have include it while writing text in this tag. It don't do  word wrap.

      Syntax:

     
    <pre> A text you want to write which will display in same format in 
      browser. </pre>

      Code:

     
    <!DOCTYPE HTML>
      <html>
      <body>
      <p> <pre> This tag is used to set formatting in a way </pre>
      </p>
      </body>
      </html>
     
      Output:

             pre.gif
 

  •  <small>:- This tag is used to display text in small in a browser.

      Syntax:

     
    <small> A text you want to display in small </small>

       Code:

      
    <!DOCTYPE HTML>
       <html>
       <body>
       <p> <small> I m </small> <b> 
       small</b> <i> tag </i> </p>
       </body>
       </html>

        Output:

               small.gif

  • <style>:- We can use this tag to provide some style to our document. We can use colour attribute with it to differentiate normal  paragraph and main heading in our document.

      Syntax:

     
    <style type=type of text you want. It can contain values text or css.> 
     After that a tag on which you want to define an attribute: an attribute
     value}</style>

      Code:

      
    <!DOCTYPE HTML>
      <html>
      <head>
      <style type="text/css">
       h1 { color:Purple}
       h2 { color:Orange}
       </style>
       </head>
       <body>
       <h1> I m style tag </h1>
       <h2> I provide style to document </h2>
       </body>
       </html>

       Output:

              style.gif    

Ebook Download
View all
Learn
View all