SlideShare a Scribd company logo
1 of 33
Table Structure
You need to know about four basic table tags, as
described next:
A table is a data structure that organizes information into rows and columns. It can be used to both
store and display data in a structured format. For example, databases store data in tables so that
information can be quickly accessed from specific rows.
Table Structure
<table>
</table>
The table tag is a container for every other tag used to create a table in
HTML. The opening and closing table tags should be placed at the
beginning
and end of your table.
<th>
</th>
The th tag stands for table header. An optional tag used instead of the td
tag,
this tag defines a cell containing header information. By default, the content
in
header cells is bolded and centered.
<tr>
</tr>
The tr tag stands for table row. The opening and closing tr tags surround the
cells for that row.
<td>
</td>
The td tag stands for table data and holds the actual content for the cell.
There
are opening and closing td tags for each cell in each row.
Attributes of a table
1. Align
2. Color
3. Border
4. Width
5. Height
6. padding
7. Pacing
With these tags in mind, you can create both basic and complex table structures
accordingto your needs. Say you want to create a basic table structure, such as the
following.
Popular Girls’
Names
Popular Boys’ Names
Emily Jacob
Sarah Michael
Your code might look like that shown next:
<table>
<tr>
<th>Popular Girls’ Names</th>
<th>Popular Boys’ Names</th>
</tr>
<tr>
<td>Emily</td>
<td>Jacob</td>
</tr>
<tr>
<td>Sarah</td>
<td>Michael</td>
</tr>
</table>
Opening and closing table tags surround the entire section of code. This tells the
browser that everything inside these tags belongs in the table. And there are
opening and closing tr tags for each row in the table. These surround td or th tags,
which, in turn, contain the actual content to be displayed by the browser.
Table with color
We can add background color to the table using the attribute "bgcolor".
This attribute can be added in "table"/"tr"/"td" tag. The color can be set on the
whole to table or to rows and column
Example Code:
<table border=1 bgcolor="green">
<tr>
<td>
This is first column
</td>
<td bgcolor="yellow">
This is second column
</td>
</tr>
</table>
CAPTION
<CAPTION> and </CAPTION> places a caption over your table. The caption will be bolded and
centered. Okay, it's a pretty dull caption. Use it if you'd like or feel free to forget it right here. I just
thought I'd show it to you. Heck, you're here aren't you?
Cellpadding and Cellspacing Attributes
There are two attributes called cellpadding and cellspacing which you will use to adjust the white
space in your table cells. The cellspacing attribute defines the width of the border, while cellpadding
represents the distance between cell borders and the content within a cell.
<html>
<head>
<title>HTML Table Cellpadding</title>
</head>
<body>
<table border="1" cellpadding="5" cellspacing=“10">
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Ramesh Raman</td>
<td>5000</td>
</tr>
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
</body>
</html>
Colspan and Rowspan Attributes
You will use colspan attribute if you want to merge two or more
columns into a single column. Similar way you will use rowspan if you
want to merge two or more rows.
Colspan and Rowspan Attributes
<html>
<head>
<title>HTML Table Colspan/Rowspan</title>
</head>
<body>
<table border="1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td><td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr>
<tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
</table>
</body>
</html>
Here is an example of using image background
attribute.
<table border="1" bordercolor="green" background="cats and dogs.jpg">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
</tr>
<tr><td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
</tr>
<tr><td colspan="3">Row 3 Cell 1</td>
</tr>
</table>
Table Height and Width
You can set a table width and height using width and height attributes.
You can specify table width or height in terms of pixels or in terms of
percentage of available screen area
<table border="1" width="400" height="150">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
Table Header, Body, and Footer
Tables can be divided into three portions: a header, a body, and a foot. The head and foot are rather
similar to headers and footers in a word-processed document that remain the same for every page,
while the body is the main content holder of the table.
The three elements for separating the head, body, and foot of a table are:
<thead> - to create a separate table header.
<tbody> - to indicate the main body of the table.
<tfoot> - to create a separate table footer.
A table may contain several <tbody> elements to indicate different pages or groups of data. But it is
notable that <thead> and <tfoot> tags should appear before <tbody>
example
<html>
<head>
<title>HTML Table</title>
</head>
<body>
<table border="1" width="100%">
<thead>
<tr>
<td colspan="4">This is the head of the table</td>
</tr>
</thead>
<tfoot>
Cont…
<tr>
<td colspan="4">This is the foot of the table</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
</tbody>
</table>
</body>
</html>
Adding CSS to tables
You can format your tables using Cascading Style Sheets (CSS). Using
CSS, you can specify background colors, border colors, border styles
etc.
Example
<table border="1" style="background-color:yellow;border:1px dotted
black;width:80%;border-collapse:collapse;">
<tr style="background-color:orange;color:white;">
<th style="padding:3px;">Table header</th><th style="padding:3px;">Table
header</th>
</tr>
<tr>
<td style="padding:3px;">Table cell 1</td><td style="padding:3px;">Table cell 2</td>
</tr>
<tr>
<td style="padding:3px;">Table cell 3</td><td style="padding:3px;">Table cell 4</td>
</tr>
</table>
Modifying table background color
<table width="20" border="1" cellspacing="0" cellpadding="0"
bgcolor="#99CCCC">
<tr>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
</tr>
<table width="20" border="1" cellspacing="0" cellpadding="">
<tr bgcolor="#FFCCCC">
<td>1</td>
<td>1</td>
</tr>
<tr bgcolor="#66CCFF">
<td>1</td>
<td>1</td>
</tr>
</table>
<table width="20" border="1" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FF99FF">0</td>
<td bgcolor="#FFCC99">0</td>
</tr>
<tr>
<td bgcolor="#FFFF33">0</td>
<td bgcolor="#663399">0</td>
</tr>
</table>
<TABLE border="1"
summary="This table gives some statistics about fruit
flies: average height and weight, and percentage
with red eyes (for both males and females).">
<CAPTION><EM>A test table with merged cells</EM></CAPTION>
<TR><TH rowspan="2"><TH colspan="2">Average
<TH rowspan="2">Red<BR>eyes
<TR><TH>height<TH>weight
<TR><TH>Males<TD>1.9<TD>0.003<TD>40%
<TR><TH>Females<TD>1.7<TD>0.002<TD>43%
</TABLE>
<TABLE border="1" cellpadding="5" cellspacing="2"
summary="History courses offered in the community of
Bath arranged by course name, tutor, summary,
code, and fee">
<TR>
<TH colspan="5" scope="colgroup">Community Courses -- Bath Autumn 2015</TH>
</TR>
<TR>
<TH scope="col" abbr="Name">Course Name</TH>
<TH scope="col" abbr="Tutor">Course Tutor</TH>
<TH scope="col">Summary</TH>
<TH scope="col">Code</TH>
<TH scope="col">Fee</TH>
</TR>
<TR>
<TD scope="row">After the Civil War</TD>
<TD>Dr. John Wroughton</TD>
<TD>
The course will examine the turbulent years in England
after 1646. <EM>6 weekly meetings starting Monday 13th
October.</EM>
</TD>
<TD>H27</TD>
<TD>&pound;32</TD>
</TR>
<TR>
<TD scope="row">An Introduction to Anglo-Saxon England</TD>
<TD>Mark Cottle</TD>
<TD>
One day course introducing the early medieval
period reconstruction the Anglo-Saxons and
their society. <EM>Saturday 18th October.</EM>
</TD>
<TD>H28</TD>
<TD>&pound;18</TD>
</TR>
<TR>
<TD scope="row">The Glory that was Greece</TD>
<TD>Valerie Lorenz</TD>
<TD>
Birthplace of democracy, philosophy, heartland of theater, home of
argument. The Romans may have done it but the Greeks did it
first. <EM>Saturday day school 25th October 1997</EM>
</TD>
<TD>H30</TD>
<TD>&pound;18</TD>
</TR>
</TABLE>
Inner Tables
a) How to create tables inside table columns?
b) How to control space between table cells?
Table inside table
Many a times we will be using table inside tables Now we will create two row with three columns.
The 2nd row, 2nd column will be split again to a table with two rows, two cols. Also we will be using
the attributes cellpadding and cellspacing to handle table space.
<table border=1 width=80% height=30% align=center cellpadding=1 cellspacing=1>
<tr height=30%>
<td>First Row</td>
<td>First Row</td>
<td>First Row</td>
</tr>
<tr height=70%>
<td>Second Row</td>
<td >
<table bgcolor=yellow border=1 width=80% height=80%>
<tr ><td> Inner Table </td>
<td> Inner Table </td>
</tr>
<tr >
<td> Inner Table </td>
<td> Inner Table </td></tr>
</table>
</td>
<td>Second Row</td>
</tr>
</table>
Table structure introduction

More Related Content

What's hot (19)

Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Web I - 03 - Tables
Web I - 03 - TablesWeb I - 03 - Tables
Web I - 03 - Tables
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
html-table
html-tablehtml-table
html-table
 
Html tables
Html tablesHtml tables
Html tables
 
Html tables examples
Html tables   examplesHtml tables   examples
Html tables examples
 
Web topic 12 tables in html
Web topic 12  tables in htmlWeb topic 12  tables in html
Web topic 12 tables in html
 
HTML Table Tags
HTML Table TagsHTML Table Tags
HTML Table Tags
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
 
Web forms and html lecture Number 3
Web forms and html lecture Number 3Web forms and html lecture Number 3
Web forms and html lecture Number 3
 
HTML Tables in Omeka
HTML Tables in OmekaHTML Tables in Omeka
HTML Tables in Omeka
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 
Frames tables forms
Frames tables formsFrames tables forms
Frames tables forms
 
Html web designing using tables
Html web designing using tablesHtml web designing using tables
Html web designing using tables
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Html
HtmlHtml
Html
 
Lect# 1 html part ii
Lect# 1 html part iiLect# 1 html part ii
Lect# 1 html part ii
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
HTML basic
HTML basicHTML basic
HTML basic
 

Similar to Table structure introduction

Similar to Table structure introduction (20)

v4-html-table-210321161424.pptx
v4-html-table-210321161424.pptxv4-html-table-210321161424.pptx
v4-html-table-210321161424.pptx
 
Handout5 tables
Handout5 tablesHandout5 tables
Handout5 tables
 
Tables
TablesTables
Tables
 
Lecture-4.pptx
Lecture-4.pptxLecture-4.pptx
Lecture-4.pptx
 
WEP4 and 5.pptx
WEP4 and 5.pptxWEP4 and 5.pptx
WEP4 and 5.pptx
 
Computer language - Html tables
Computer language - Html tablesComputer language - Html tables
Computer language - Html tables
 
01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx
 
Html tables
Html tablesHtml tables
Html tables
 
HTML Tables.ppt
HTML Tables.pptHTML Tables.ppt
HTML Tables.ppt
 
HTML
HTMLHTML
HTML
 
Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
 
Working With Tables in HTML
Working With Tables in HTMLWorking With Tables in HTML
Working With Tables in HTML
 
Lecture 5 html table
Lecture 5 html tableLecture 5 html table
Lecture 5 html table
 
Table in MS Frontpage 2003
Table in MS Frontpage 2003Table in MS Frontpage 2003
Table in MS Frontpage 2003
 
Lecture 2.ppt
Lecture 2.pptLecture 2.ppt
Lecture 2.ppt
 
HTML Lecture Part 2 of 2
HTML Lecture Part 2 of 2HTML Lecture Part 2 of 2
HTML Lecture Part 2 of 2
 
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
 
Html basics 7 table
Html basics 7 tableHtml basics 7 table
Html basics 7 table
 
Response Tables.ppt
Response Tables.pptResponse Tables.ppt
Response Tables.ppt
 
2. HTML Tables.ppt
2. HTML Tables.ppt2. HTML Tables.ppt
2. HTML Tables.ppt
 

More from nobel mujuji

Inserting imagesin html
Inserting imagesin htmlInserting imagesin html
Inserting imagesin htmlnobel mujuji
 
Html images and html backgrounds
Html images and html backgroundsHtml images and html backgrounds
Html images and html backgroundsnobel mujuji
 
Html character entities
Html character entitiesHtml character entities
Html character entitiesnobel mujuji
 
Chapter 2 introduction to html5
Chapter 2 introduction to html5Chapter 2 introduction to html5
Chapter 2 introduction to html5nobel mujuji
 
Chapter 1 one html
Chapter 1 one htmlChapter 1 one html
Chapter 1 one htmlnobel mujuji
 
Adding text in html
Adding text in htmlAdding text in html
Adding text in htmlnobel mujuji
 
Javascript conditional statements
Javascript conditional statementsJavascript conditional statements
Javascript conditional statementsnobel mujuji
 

More from nobel mujuji (14)

Positioning text
Positioning textPositioning text
Positioning text
 
Inserting imagesin html
Inserting imagesin htmlInserting imagesin html
Inserting imagesin html
 
Html images and html backgrounds
Html images and html backgroundsHtml images and html backgrounds
Html images and html backgrounds
 
Html hyperlinks
Html hyperlinksHtml hyperlinks
Html hyperlinks
 
Html frames
Html framesHtml frames
Html frames
 
Html forms
Html formsHtml forms
Html forms
 
Html character entities
Html character entitiesHtml character entities
Html character entities
 
Horizontal lines!
Horizontal lines!Horizontal lines!
Horizontal lines!
 
Creating lists
Creating listsCreating lists
Creating lists
 
Chapter 2 introduction to html5
Chapter 2 introduction to html5Chapter 2 introduction to html5
Chapter 2 introduction to html5
 
Chapter 1 one html
Chapter 1 one htmlChapter 1 one html
Chapter 1 one html
 
Chapter 1 html
Chapter 1 htmlChapter 1 html
Chapter 1 html
 
Adding text in html
Adding text in htmlAdding text in html
Adding text in html
 
Javascript conditional statements
Javascript conditional statementsJavascript conditional statements
Javascript conditional statements
 

Recently uploaded

Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeCredit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeBoston Institute of Analytics
 
DS Lecture-1 about discrete structure .ppt
DS Lecture-1 about discrete structure .pptDS Lecture-1 about discrete structure .ppt
DS Lecture-1 about discrete structure .pptTanveerAhmed817946
 
DAA Assignment Solution.pdf is the best1
DAA Assignment Solution.pdf is the best1DAA Assignment Solution.pdf is the best1
DAA Assignment Solution.pdf is the best1sinhaabhiyanshu
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATIONLakpaYanziSherpa
 
Introduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptxIntroduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptxAniqa Zai
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...yulianti213969
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024patrickdtherriault
 
Seven tools of quality control.slideshare
Seven tools of quality control.slideshareSeven tools of quality control.slideshare
Seven tools of quality control.slideshareraiaryan448
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabiaahmedjiabur940
 
Bios of leading Astrologers & Researchers
Bios of leading Astrologers & ResearchersBios of leading Astrologers & Researchers
Bios of leading Astrologers & Researchersdarmandersingh4580
 
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token PredictionNABLAS株式会社
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样wsppdmt
 
Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...
Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...
Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...Voces Mineras
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证pwgnohujw
 
jll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdfjll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdfjaytendertech
 
Huawei Ransomware Protection Storage Solution Technical Overview Presentation...
Huawei Ransomware Protection Storage Solution Technical Overview Presentation...Huawei Ransomware Protection Storage Solution Technical Overview Presentation...
Huawei Ransomware Protection Storage Solution Technical Overview Presentation...LuisMiguelPaz5
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...ThinkInnovation
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证acoha1
 
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptxRESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptxronsairoathenadugay
 

Recently uploaded (20)

Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeCredit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
DS Lecture-1 about discrete structure .ppt
DS Lecture-1 about discrete structure .pptDS Lecture-1 about discrete structure .ppt
DS Lecture-1 about discrete structure .ppt
 
DAA Assignment Solution.pdf is the best1
DAA Assignment Solution.pdf is the best1DAA Assignment Solution.pdf is the best1
DAA Assignment Solution.pdf is the best1
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 
Introduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptxIntroduction to Statistics Presentation.pptx
Introduction to Statistics Presentation.pptx
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024
 
Seven tools of quality control.slideshare
Seven tools of quality control.slideshareSeven tools of quality control.slideshare
Seven tools of quality control.slideshare
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Bios of leading Astrologers & Researchers
Bios of leading Astrologers & ResearchersBios of leading Astrologers & Researchers
Bios of leading Astrologers & Researchers
 
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...
Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...
Las implicancias del memorándum de entendimiento entre Codelco y SQM según la...
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
 
jll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdfjll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdf
 
Huawei Ransomware Protection Storage Solution Technical Overview Presentation...
Huawei Ransomware Protection Storage Solution Technical Overview Presentation...Huawei Ransomware Protection Storage Solution Technical Overview Presentation...
Huawei Ransomware Protection Storage Solution Technical Overview Presentation...
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
 
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptxRESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
RESEARCH-FINAL-DEFENSE-PPT-TEMPLATE.pptx
 

Table structure introduction

  • 1. Table Structure You need to know about four basic table tags, as described next:
  • 2. A table is a data structure that organizes information into rows and columns. It can be used to both store and display data in a structured format. For example, databases store data in tables so that information can be quickly accessed from specific rows.
  • 3. Table Structure <table> </table> The table tag is a container for every other tag used to create a table in HTML. The opening and closing table tags should be placed at the beginning and end of your table. <th> </th> The th tag stands for table header. An optional tag used instead of the td tag, this tag defines a cell containing header information. By default, the content in header cells is bolded and centered. <tr> </tr> The tr tag stands for table row. The opening and closing tr tags surround the cells for that row. <td> </td> The td tag stands for table data and holds the actual content for the cell. There are opening and closing td tags for each cell in each row.
  • 4. Attributes of a table 1. Align 2. Color 3. Border 4. Width 5. Height 6. padding 7. Pacing
  • 5. With these tags in mind, you can create both basic and complex table structures accordingto your needs. Say you want to create a basic table structure, such as the following. Popular Girls’ Names Popular Boys’ Names Emily Jacob Sarah Michael
  • 6. Your code might look like that shown next: <table> <tr> <th>Popular Girls’ Names</th> <th>Popular Boys’ Names</th> </tr> <tr> <td>Emily</td> <td>Jacob</td> </tr> <tr> <td>Sarah</td> <td>Michael</td> </tr> </table>
  • 7. Opening and closing table tags surround the entire section of code. This tells the browser that everything inside these tags belongs in the table. And there are opening and closing tr tags for each row in the table. These surround td or th tags, which, in turn, contain the actual content to be displayed by the browser. Table with color We can add background color to the table using the attribute "bgcolor". This attribute can be added in "table"/"tr"/"td" tag. The color can be set on the whole to table or to rows and column
  • 8. Example Code: <table border=1 bgcolor="green"> <tr> <td> This is first column </td> <td bgcolor="yellow"> This is second column </td> </tr> </table>
  • 9. CAPTION <CAPTION> and </CAPTION> places a caption over your table. The caption will be bolded and centered. Okay, it's a pretty dull caption. Use it if you'd like or feel free to forget it right here. I just thought I'd show it to you. Heck, you're here aren't you?
  • 10. Cellpadding and Cellspacing Attributes There are two attributes called cellpadding and cellspacing which you will use to adjust the white space in your table cells. The cellspacing attribute defines the width of the border, while cellpadding represents the distance between cell borders and the content within a cell.
  • 11. <html> <head> <title>HTML Table Cellpadding</title> </head> <body> <table border="1" cellpadding="5" cellspacing=“10"> <tr> <th>Name</th> <th>Salary</th> </tr> <tr> <td>Ramesh Raman</td> <td>5000</td> </tr> <tr> <td>Shabbir Hussein</td> <td>7000</td> </tr> </table> </body> </html>
  • 12. Colspan and Rowspan Attributes You will use colspan attribute if you want to merge two or more columns into a single column. Similar way you will use rowspan if you want to merge two or more rows.
  • 13. Colspan and Rowspan Attributes <html> <head> <title>HTML Table Colspan/Rowspan</title> </head> <body> <table border="1"> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> <tr><td rowspan="2">Row 1 Cell 1</td><td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr> <tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr> <tr><td colspan="3">Row 3 Cell 1</td></tr> </table> </body> </html>
  • 14. Here is an example of using image background attribute. <table border="1" bordercolor="green" background="cats and dogs.jpg"> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> <tr><td rowspan="2">Row 1 Cell 1</td> <td>Row 1 Cell 2</td> <td>Row 1 Cell 3</td> </tr> <tr><td>Row 2 Cell 2</td> <td>Row 2 Cell 3</td> </tr> <tr><td colspan="3">Row 3 Cell 1</td> </tr> </table>
  • 15. Table Height and Width You can set a table width and height using width and height attributes. You can specify table width or height in terms of pixels or in terms of percentage of available screen area
  • 16. <table border="1" width="400" height="150"> <tr> <td>Row 1, Column 1</td> <td>Row 1, Column 2</td> </tr> <tr> <td>Row 2, Column 1</td> <td>Row 2, Column 2</td> </tr> </table>
  • 17. Table Header, Body, and Footer Tables can be divided into three portions: a header, a body, and a foot. The head and foot are rather similar to headers and footers in a word-processed document that remain the same for every page, while the body is the main content holder of the table. The three elements for separating the head, body, and foot of a table are: <thead> - to create a separate table header. <tbody> - to indicate the main body of the table. <tfoot> - to create a separate table footer. A table may contain several <tbody> elements to indicate different pages or groups of data. But it is notable that <thead> and <tfoot> tags should appear before <tbody>
  • 18. example <html> <head> <title>HTML Table</title> </head> <body> <table border="1" width="100%"> <thead> <tr> <td colspan="4">This is the head of the table</td> </tr> </thead> <tfoot>
  • 19. Cont… <tr> <td colspan="4">This is the foot of the table</td> </tr> </tfoot> <tbody> <tr> <td>Cell 1</td> <td>Cell 2</td> <td>Cell 3</td> <td>Cell 4</td> </tr> </tbody> </table> </body> </html>
  • 20. Adding CSS to tables You can format your tables using Cascading Style Sheets (CSS). Using CSS, you can specify background colors, border colors, border styles etc.
  • 21. Example <table border="1" style="background-color:yellow;border:1px dotted black;width:80%;border-collapse:collapse;"> <tr style="background-color:orange;color:white;"> <th style="padding:3px;">Table header</th><th style="padding:3px;">Table header</th> </tr> <tr> <td style="padding:3px;">Table cell 1</td><td style="padding:3px;">Table cell 2</td> </tr> <tr> <td style="padding:3px;">Table cell 3</td><td style="padding:3px;">Table cell 4</td> </tr> </table>
  • 22. Modifying table background color <table width="20" border="1" cellspacing="0" cellpadding="0" bgcolor="#99CCCC"> <tr> <td>0</td> <td>0</td> </tr> <tr> <td>0</td> <td>0</td> </tr>
  • 23. <table width="20" border="1" cellspacing="0" cellpadding=""> <tr bgcolor="#FFCCCC"> <td>1</td> <td>1</td> </tr> <tr bgcolor="#66CCFF"> <td>1</td> <td>1</td> </tr> </table>
  • 24. <table width="20" border="1" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#FF99FF">0</td> <td bgcolor="#FFCC99">0</td> </tr> <tr> <td bgcolor="#FFFF33">0</td> <td bgcolor="#663399">0</td> </tr> </table>
  • 25. <TABLE border="1" summary="This table gives some statistics about fruit flies: average height and weight, and percentage with red eyes (for both males and females)."> <CAPTION><EM>A test table with merged cells</EM></CAPTION> <TR><TH rowspan="2"><TH colspan="2">Average <TH rowspan="2">Red<BR>eyes <TR><TH>height<TH>weight <TR><TH>Males<TD>1.9<TD>0.003<TD>40% <TR><TH>Females<TD>1.7<TD>0.002<TD>43% </TABLE>
  • 26. <TABLE border="1" cellpadding="5" cellspacing="2" summary="History courses offered in the community of Bath arranged by course name, tutor, summary, code, and fee"> <TR> <TH colspan="5" scope="colgroup">Community Courses -- Bath Autumn 2015</TH> </TR> <TR> <TH scope="col" abbr="Name">Course Name</TH> <TH scope="col" abbr="Tutor">Course Tutor</TH> <TH scope="col">Summary</TH> <TH scope="col">Code</TH> <TH scope="col">Fee</TH> </TR>
  • 27. <TR> <TD scope="row">After the Civil War</TD> <TD>Dr. John Wroughton</TD> <TD> The course will examine the turbulent years in England after 1646. <EM>6 weekly meetings starting Monday 13th October.</EM> </TD> <TD>H27</TD> <TD>&pound;32</TD> </TR> <TR> <TD scope="row">An Introduction to Anglo-Saxon England</TD> <TD>Mark Cottle</TD> <TD> One day course introducing the early medieval period reconstruction the Anglo-Saxons and their society. <EM>Saturday 18th October.</EM> </TD> <TD>H28</TD> <TD>&pound;18</TD> </TR>
  • 28. <TR> <TD scope="row">The Glory that was Greece</TD> <TD>Valerie Lorenz</TD> <TD> Birthplace of democracy, philosophy, heartland of theater, home of argument. The Romans may have done it but the Greeks did it first. <EM>Saturday day school 25th October 1997</EM> </TD> <TD>H30</TD> <TD>&pound;18</TD> </TR> </TABLE>
  • 29. Inner Tables a) How to create tables inside table columns? b) How to control space between table cells?
  • 30. Table inside table Many a times we will be using table inside tables Now we will create two row with three columns. The 2nd row, 2nd column will be split again to a table with two rows, two cols. Also we will be using the attributes cellpadding and cellspacing to handle table space.
  • 31. <table border=1 width=80% height=30% align=center cellpadding=1 cellspacing=1> <tr height=30%> <td>First Row</td> <td>First Row</td> <td>First Row</td> </tr> <tr height=70%> <td>Second Row</td> <td > <table bgcolor=yellow border=1 width=80% height=80%> <tr ><td> Inner Table </td> <td> Inner Table </td> </tr>
  • 32. <tr > <td> Inner Table </td> <td> Inner Table </td></tr> </table> </td> <td>Second Row</td> </tr> </table>