Style tags in HTML 5
1. <b>:- This tag is used to
display a text in bold in the 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:
2. <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:
3. <pre>:- This tag
is used to set formatting in such a way, that the way
we write it, it will
display in the browser in the same format. It will also include white space if you have included it while writing text in this tag. It doesn'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:
4. <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:
5. <style>:- We can use
this tag to provide some style to our document. We can use color attribute with it to differentiate normal paragraphs 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: