Skip to main content

Table Tag & Its sub tags and Attributes along with live execution

Table TAG

Table Tag :

Table in HTML is a combination of rows and columns.

Sarting Tag : <table> Ending tag : </table> and Table tag has different types of Subtags as below

Subtags of Table Tag :

  1. <tr> </tr> Tag : It is used to define a row in a table.
  2. <th> </th> Tag : It is used to define header cell in a table.
  3. <td> </td> Tag : It defines a cell in a table.
  4. <caption> </caption> Tag : it is used to Give caption for the table
For this first take a notepad and copy code then save it with .html extension.Thats it your Program will be exected.if You want to check its effect within this website plese click on EXECUTE button. To get table as shown below we will follow below four steps

1. This is the table without caption and table header tags.

CODE <html> <head> <title> Table Tag </title> <style type="text/css"> </style> </head> <body > <table> <tr> <td> Sl.no </td> <td> Employee Name </td> <td> Salary in Thousands </td> <td> Age In Years </td> </tr> <tr> <td> 1 </td> <td> K.madhuSudhan rao </td> <td> 50 </td> <td> 27 </td> </tr> <tr> <td> 2 </td> <td> Madhavi </td> <td> 40 </td> <td> 27 </td> </tr> <tr> <td> 3 </td> <td> Sruthi </td> <td> 30 </td> <td> 30 </td> </tr> <tr> <td> 4 </td> <td> Maruthi </td> <td> 35 </td> <td> 30 </td> </tr> </table> </body> </html>
OutPut (Click on above execute Button)

2. This is the table with Caption and Header tags.

CODE <html> <head> <title> Table Tag </title> <style type="text/css"> </style> </head> <body > <table> <caption> This is the table with Caption and Header tags. </caption> <tr> <th> Sl.no </th> <th> Employee Name </th> <th> Salary in Thousands </th> <th> Age In Years </th> </tr> <tr> <td> 1 </td> <td> K.madhuSudhan rao </td> <td> 50 </td> <td> 27 </td> </tr> <tr> <td> 2 </td> <td> Madhavi </td> <td> 40 </td> <td> 27 </td> </tr> <tr> <td> 3 </td> <td> Sruthi </td> <td> 30 </td> <td> 30 </td> </tr> <tr> <td> 4 </td> <td> Maruthi </td> <td> 35 </td> <td> 30 </td> </tr> </table> </body> </html>
OutPut (Click on above execute Button)

Attributes of Table Tag :

  1. Width : It is used to define width of the table.Its values interms of percentage like 10%,20% Etc.
  2. bgcolor : It is used to define color for the table.Its values interms of names of colours or in hexa decimals.
  3. Align : It is used to define alignment of values in the table.Its values like left ,right and center .
  4. border : It is used to set the border for the table.Its values starting from 0 to Infinity.
  5. colspan : it is used to make cell span more than one column.If you want make same cell value for more than one coloumn you can you this attribute.
  6. rowspan : it is used to make cell span more than one row .If you want make same cell value for more than one row you can you this attribute.

3. Using of Width ,bgcolor,Align and Border attribute of the Table.

CODE <html> <head> <title> Table Tag </title> <style type="text/css"> </style> </head> <body > <table width="50%" border="1" Align="center"> <caption> This is the table with Caption and Header tags. </caption> <tr bgcolor="grey"> <th> Sl.no </th> <th> Employee Name </th> <th> Salary in Thousands </th> <th> Age In Years </th> </tr> <tr> <td> 1 </td> <td> K.madhuSudhan rao </td> <td> 50 </td> <td> 27 </td> </tr> <tr bgcolor="grey"> <td> 2 </td> <td> Madhavi </td> <td> 40 </td> <td> 27 </td> </tr> <tr> <td> 3 </td> <td> Sruthi </td> <td> 30 </td> <td> 30 </td> </tr> <tr bgcolor="grey"> <td> 4 </td> <td> Maruthi </td> <td> 35 </td> <td> 30 </td> </tr> </table> </body> </html>
OutPut (Click on above execute Button)

4. Using of Width ,bgcolor,Align and Border attribute of the Table along with rowspan and colspan.

CODE <html> <head> <title> Table Tag </title> <style type="text/css"> </style> </head> <body > <table width="50%" border="1" Align="center"> <caption><b><u> This is the table with Caption and Header </u> </b> tags. </caption> <tr bgcolor="grey"> <th> Sl.no </th> <th> Employee Name </th> <th> Salary in Thousands </th> <th> Age In Years </th> </tr> <tr> <td> 1 </td> <td> K.madhuSudhan rao </td> <td> 50 </td> <td rowspan="2"> 27 </td> </tr> <tr bgcolor="grey"> <td> 2 </td> <td> Madhavi </td> <td> 40 </td> </tr> <tr> <td> 3 </td> <td> Sruthi </td> <td colspan="2"> 30 </td> </tr> <tr bgcolor="grey"> <td> 4 </td> <td> Maruthi </td> <td> 35 </td> <td> 30 </td> </tr> </table> </body> </html>
OutPut (Click on above execute Button)

Comments

Popular posts from this blog

Computer awareness questions asked in RRB PO Part II

Computer awareness questions asked in RRB PO Part II Part -I Part - II Learn them from below Q 1) which of the following is not a is not an email service ? A. Bing B. yandex C. gmail D.Yahoo View Answer & Explanation Q 2) Which of the following is incorrect declaration of file name in Windows 7 ? A.mydoc:file.doc B.Mydoc hai.doc C.Mydoc_hai.doc D. Mydoc.doc View Answer & Explanation Q 3)Which of the following is correct mail id ? A. @mymail.com B. msrgmail.com C. msr@.com D. msr@gmail.com View Answer & Explanation Q 4) Which of the following is a software that that is available free of cost but do not provide any freedom of modifying, sharing and studying the program ? A.Free ware B.share ware C. Open source D.Adware View Answer & Explanation ...

Fieldset and Pre Tags in HTML with Live execution

Fieldset Tag in HTML Fieldset & Pre Tags in HTML : 1. Fieldset Tag : is used for grouping related form elements in a box.It is used to give user a clear view about Content. Starting tag : Ending tag : 2. Legend Tag : Legend tag is used to give title for Fieldset. Starting tag : Ending tag : 3. Pre Tag : Pre tag is used to set alignment of your web page as coded line wise . Starting tag : Ending tag : For this first take a notepad and copy code then save it with .html extension.Thats it your Program will be exected.if You want to check its effect within this website plese click on EXECUTE button. CODE Fieldset ,Pre TAGs Login Page User Name : Password : OutPut (...

Part 4 : Top 500 Computer Awareness Previously Asked Questions

Top 500 Computer Awareness questions Take Quiz from below Q 1) In Network layer , data transferred interns of _______________ ? frames packets bits segments Q 2) What is the shortcut for creating new slide from already existing slide ? contrl + N contrl + M contrl + V contrl + R Q 3) What is the extension for MS-ACCESS ? ACCDB XLS DOCX ACCESS Q 4) Which of the following is volatile memory ? HARD DISK ROM RAM COMPACT DISK Q 5) What is used to identify Particular page on web ? ? HYPERLINK URI URL SERVER ADDRESS Q 6) Which one of the fo...