Basic HTML TAGS


HTML TAGS
TAGS & ITS DESCRIPTION:

1. <head>
                Defines the information about the document
Syntax : <head> <title>Title </title> </head>
Eg. <head>….</head>
               
2. <title>
                Defines the document title.
Syntax : <title> Title </title>
Eg. <title> Tags </title>

3. <pre>
                Defines the pre-formatted text. Text in <pre> element is displayed in a fixed width font and it preserves both spaces and line breaks.
Syntax : <pre> Content </pre>
Eg.
<pre>
                Title
Web Technology
</pre>
O/p:
                Title
Web Technology

4. <body>
                Defines the document's body. The body element contains the contents of  HTML document.
Syntax : <body> Content </body>
Attributes : background, bgcolor,etc.
Eg. : <body> Body </body>
O/p:
Body

5. <p>
                Defines a paragraph. Browsers automatically adds some space before and after each <p> element.
Syntax: <p> Content </p>
Attributes : background, bgcolor,etc.
Eg. : <p> Paragraph </p>
O/p:
                Paragraph

6. <br>
                It inserts a single line break.
Syntax : </br>
Eg. : This text has </br> line break. It is an empty tag.
O/p:
This text has
line break. It is an empty tag.
7. <h1> to <h6>
                Defines HTML headings
<h1> defines the most important heading and
<h6> defines the least important heading.
Syntax : <h1> Content </h1>
Eg. <h1> Heading 1 </h1>
      <h6> Heading 6 </h6>
O/p:
Heading 1
Heading 6
               
8. <tt>
                Defines teltype text. It renders as teltype text.
Syntax : <tt> Content </tt>
Eg. : <tt> teltype text </tt>
O/p:
teltype text

9. <hr>
                Defines a horizontal line. It is a empty tag which draws a horizontal line, where specified.
Syntax : <hr/>
Eg. : Text <hr/> Line
Text


Line

10. <sub>
                Defines by subscripted text.
Syntax : <sub> Content </sub>
Eg. : Log <sub>10 </sub>
O/p:
Log10

11. <img>
                It is an empty tag which defines an image in the HTML page.
Syntax : <img src="url"/>
Attributes: It has two required attributes
§  src
§  alt
                                Others are width, height,etc.

12. <a>
                Defines an anchor.
Two ways :
§  Create link using href attribute.
§  Create bookmark using name attribute.
Attributes : Required attribute is href.
Others are color, etc.
Syntax : <a href="url"> Content </a>
Eg. : <a href=www.example.com> Visit!! </a>
O/p:
Visit

13. <ul>
                Defines an unordered list. Together with <li> is used to create unordered list.
Syntax: <ul> <li> Content 1 </li>
                         <li> Content 2 </li>
                </ul>
Eg. : <ul>
                <li> One</li>
                <li> Two </li>
         </ul>

O/p:
o   One
o   Two

14. <table>
                Defines a table.
<tr> defines a row in a table.
<th> defines a header cell in a table.
<td> defines a cell in a table.
Syntax : <table> <tr> <td> Content </td> </tr> </table>
Attributes : caption, color,etc.
Eg. : <table> <tr> <td> One </td>
                                  <td> Two </td>
                        </tr> </table>

O/p:

One
Two

15. <span>
                Defines a section in the document.
Syntax: <span> Content </span>
Attributes : style, font-weight, color, etc.
Eg. : My mother has <span style="color:blue; font-weight:bold"> light blue </span> eyes.
O/p:
My mother has light blue eyes.

16. <style>
                Defines the style information for a document. It is defined in the head tag.
Syntax : <style> rules </styles>
Eg. : <style type="text/css">
                h1 {color:red;}
                p {color: blue;}
       </style>

17. <acronym>
                Defines an acronym.
Syntax : <acronym title="title"> Content </acronym>
Eg. : <acronym title="Take Care"> TC </acronym>
O/p:
TC



18. <legend>
                Describes the caption of the <fieldset> element.
Syntax : <legend> Content </legend>
Eg. : <form> <fielset>
                                <legend> Details </legend>
                                <pre> Name :
                                                E-mail :
                                </pre>
       </fieldset></form>

19. <object>
                Defines an embedded object.
Syntax : <object data=" path"> </object>
Eg. : <object width="400" height="400" data=" hello.swf"> </object>
O/p:
The corresponding video will be embedded.

20. <div>
                Defines a set of content in the defined format.
Syntax : <div id="name"> Content </div>
Eg. : <div bgcolor="red" font="sansserif"> Content </div>

Comments