SlideShare a Scribd company logo
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
Ad

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
Marlon Jamera
 
Web I - 03 - Tables
Web I - 03 - TablesWeb I - 03 - Tables
Web I - 03 - Tables
Randy Connolly
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
BG Java EE Course
 
html-table
html-tablehtml-table
html-table
Dhirendra Chauhan
 
Html tables
Html tablesHtml tables
Html tables
Sikandar Pandit
 
Html tables examples
Html tables   examplesHtml tables   examples
Html tables examples
Mukesh Tekwani
 
Web topic 12 tables in html
Web topic 12  tables in htmlWeb topic 12  tables in html
Web topic 12 tables in html
CK Yang
 
HTML Table Tags
HTML Table TagsHTML Table Tags
HTML Table Tags
Kainat Ilyas
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
Steve Guinan
 
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
Mudasir Syed
 
HTML Tables in Omeka
HTML Tables in OmekaHTML Tables in Omeka
HTML Tables in Omeka
American Antiquarian Society
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
Aarti P
 
Frames tables forms
Frames tables formsFrames tables forms
Frames tables forms
nobel mujuji
 
Html web designing using tables
Html web designing using tablesHtml web designing using tables
Html web designing using tables
Jesus Obenita Jr.
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
Doncho Minkov
 
Html
HtmlHtml
Html
samanbandaraherath
 
Lect# 1 html part ii
Lect# 1 html part iiLect# 1 html part ii
Lect# 1 html part ii
MuhammadAbdulSattarC
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
club23
 
HTML basic
HTML basicHTML basic
HTML basic
Yoeung Vibol
 

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
HemantBansal35
 
Handout5 tables
Handout5 tablesHandout5 tables
Handout5 tables
Nadine Guevarra
 
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptxnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
Orin18
 
Tables
TablesTables
Tables
savitamhaske
 
Lecture-4.pptx
Lecture-4.pptxLecture-4.pptx
Lecture-4.pptx
vishal choudhary
 
WEP4 and 5.pptx
WEP4 and 5.pptxWEP4 and 5.pptx
WEP4 and 5.pptx
MLikithMahendra
 
ClasServer-Side Development 2: Node.jss08 .pdf
ClasServer-Side Development 2: Node.jss08 .pdfClasServer-Side Development 2: Node.jss08 .pdf
ClasServer-Side Development 2: Node.jss08 .pdf
kasperkey106
 
HTML_Tables Attribut and omformationes.pptx
HTML_Tables Attribut and omformationes.pptxHTML_Tables Attribut and omformationes.pptx
HTML_Tables Attribut and omformationes.pptx
vaibhavlucifer1
 
Computer language - Html tables
Computer language - Html tablesComputer language - Html tables
Computer language - Html tables
Dr. I. Uma Maheswari Maheswari
 
Method of creating table using HTML.pptx
Method of creating table using HTML.pptxMethod of creating table using HTML.pptx
Method of creating table using HTML.pptx
mkrv0617
 
Method of creating table using HTML.pptx
Method of creating table using HTML.pptxMethod of creating table using HTML.pptx
Method of creating table using HTML.pptx
mkrv0617
 
01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx
AhmedAlmughalis1
 
Html tables
Html tablesHtml tables
Html tables
Himanshu Pathak
 
Chapterrrrrrrrrrr_10_Building Tables.pdf
Chapterrrrrrrrrrr_10_Building Tables.pdfChapterrrrrrrrrrr_10_Building Tables.pdf
Chapterrrrrrrrrrr_10_Building Tables.pdf
ankitayadavay123
 
HTML (Table and Multimedia): Understanding Web Development Essentials
HTML (Table and Multimedia): Understanding Web Development EssentialsHTML (Table and Multimedia): Understanding Web Development Essentials
HTML (Table and Multimedia): Understanding Web Development Essentials
DlerOsman1
 
HTML Tables.ppt
HTML Tables.pptHTML Tables.ppt
HTML Tables.ppt
ShararehShojaei1
 
HTML
HTMLHTML
HTML
Doeun KOCH
 
Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
Yaowaluck Promdee
 
Working With Tables in HTML
Working With Tables in HTMLWorking With Tables in HTML
Working With Tables in HTML
Shehzad Yaqoob
 
Lecture 5 html table
Lecture 5 html tableLecture 5 html table
Lecture 5 html table
AliMUSSA3
 
v4-html-table-210321161424.pptx
v4-html-table-210321161424.pptxv4-html-table-210321161424.pptx
v4-html-table-210321161424.pptx
HemantBansal35
 
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptxnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
Orin18
 
ClasServer-Side Development 2: Node.jss08 .pdf
ClasServer-Side Development 2: Node.jss08 .pdfClasServer-Side Development 2: Node.jss08 .pdf
ClasServer-Side Development 2: Node.jss08 .pdf
kasperkey106
 
HTML_Tables Attribut and omformationes.pptx
HTML_Tables Attribut and omformationes.pptxHTML_Tables Attribut and omformationes.pptx
HTML_Tables Attribut and omformationes.pptx
vaibhavlucifer1
 
Method of creating table using HTML.pptx
Method of creating table using HTML.pptxMethod of creating table using HTML.pptx
Method of creating table using HTML.pptx
mkrv0617
 
Method of creating table using HTML.pptx
Method of creating table using HTML.pptxMethod of creating table using HTML.pptx
Method of creating table using HTML.pptx
mkrv0617
 
Chapterrrrrrrrrrr_10_Building Tables.pdf
Chapterrrrrrrrrrr_10_Building Tables.pdfChapterrrrrrrrrrr_10_Building Tables.pdf
Chapterrrrrrrrrrr_10_Building Tables.pdf
ankitayadavay123
 
HTML (Table and Multimedia): Understanding Web Development Essentials
HTML (Table and Multimedia): Understanding Web Development EssentialsHTML (Table and Multimedia): Understanding Web Development Essentials
HTML (Table and Multimedia): Understanding Web Development Essentials
DlerOsman1
 
Working With Tables in HTML
Working With Tables in HTMLWorking With Tables in HTML
Working With Tables in HTML
Shehzad Yaqoob
 
Lecture 5 html table
Lecture 5 html tableLecture 5 html table
Lecture 5 html table
AliMUSSA3
 
Ad

More from nobel mujuji (14)

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

Recently uploaded (20)

Fundamentals of Data Analysis, its types, tools, algorithms
Fundamentals of Data Analysis, its types, tools, algorithmsFundamentals of Data Analysis, its types, tools, algorithms
Fundamentals of Data Analysis, its types, tools, algorithms
priyaiyerkbcsc
 
Process Mining Machine Recoveries to Reduce Downtime
Process Mining Machine Recoveries to Reduce DowntimeProcess Mining Machine Recoveries to Reduce Downtime
Process Mining Machine Recoveries to Reduce Downtime
Process mining Evangelist
 
What is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdfWhat is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdf
SaikatBasu37
 
Time series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdfTime series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdf
asmaamahmoudsaeed
 
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdfZ14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Fariborz Seyedloo
 
Introduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdfIntroduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdf
AbdurahmanAbd
 
Transforming health care with ai powered
Transforming health care with ai poweredTransforming health care with ai powered
Transforming health care with ai powered
gowthamarvj
 
lecture_13 tree in mmmmmmmm mmmmmfftro.pptx
lecture_13 tree in mmmmmmmm     mmmmmfftro.pptxlecture_13 tree in mmmmmmmm     mmmmmfftro.pptx
lecture_13 tree in mmmmmmmm mmmmmfftro.pptx
sarajafffri058
 
Mining a Global Trade Process with Data Science - Microsoft
Mining a Global Trade Process with Data Science - MicrosoftMining a Global Trade Process with Data Science - Microsoft
Mining a Global Trade Process with Data Science - Microsoft
Process mining Evangelist
 
HershAggregator (2).pdf musicretaildistribution
HershAggregator (2).pdf musicretaildistributionHershAggregator (2).pdf musicretaildistribution
HershAggregator (2).pdf musicretaildistribution
hershtara1
 
Lagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdfLagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdf
benuju2016
 
TOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdf
TOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdfTOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdf
TOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdf
NhiV747372
 
Process Mining as Enabler for Digital Transformations
Process Mining as Enabler for Digital TransformationsProcess Mining as Enabler for Digital Transformations
Process Mining as Enabler for Digital Transformations
Process mining Evangelist
 
hersh's midterm project.pdf music retail and distribution
hersh's midterm project.pdf music retail and distributionhersh's midterm project.pdf music retail and distribution
hersh's midterm project.pdf music retail and distribution
hershtara1
 
Automated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptxAutomated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptx
handrymaharjan23
 
Sets theories and applications that can used to imporve knowledge
Sets theories and applications that can used to imporve knowledgeSets theories and applications that can used to imporve knowledge
Sets theories and applications that can used to imporve knowledge
saumyasl2020
 
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
disnakertransjabarda
 
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
Taqyea
 
Understanding Complex Development Processes
Understanding Complex Development ProcessesUnderstanding Complex Development Processes
Understanding Complex Development Processes
Process mining Evangelist
 
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial IntelligenceDr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug
 
Fundamentals of Data Analysis, its types, tools, algorithms
Fundamentals of Data Analysis, its types, tools, algorithmsFundamentals of Data Analysis, its types, tools, algorithms
Fundamentals of Data Analysis, its types, tools, algorithms
priyaiyerkbcsc
 
Process Mining Machine Recoveries to Reduce Downtime
Process Mining Machine Recoveries to Reduce DowntimeProcess Mining Machine Recoveries to Reduce Downtime
Process Mining Machine Recoveries to Reduce Downtime
Process mining Evangelist
 
What is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdfWhat is ETL? Difference between ETL and ELT?.pdf
What is ETL? Difference between ETL and ELT?.pdf
SaikatBasu37
 
Time series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdfTime series for yotube_1_data anlysis.pdf
Time series for yotube_1_data anlysis.pdf
asmaamahmoudsaeed
 
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdfZ14_IBM__APL_by_Christian_Demmer_IBM.pdf
Z14_IBM__APL_by_Christian_Demmer_IBM.pdf
Fariborz Seyedloo
 
Introduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdfIntroduction to systems thinking tools_Eng.pdf
Introduction to systems thinking tools_Eng.pdf
AbdurahmanAbd
 
Transforming health care with ai powered
Transforming health care with ai poweredTransforming health care with ai powered
Transforming health care with ai powered
gowthamarvj
 
lecture_13 tree in mmmmmmmm mmmmmfftro.pptx
lecture_13 tree in mmmmmmmm     mmmmmfftro.pptxlecture_13 tree in mmmmmmmm     mmmmmfftro.pptx
lecture_13 tree in mmmmmmmm mmmmmfftro.pptx
sarajafffri058
 
Mining a Global Trade Process with Data Science - Microsoft
Mining a Global Trade Process with Data Science - MicrosoftMining a Global Trade Process with Data Science - Microsoft
Mining a Global Trade Process with Data Science - Microsoft
Process mining Evangelist
 
HershAggregator (2).pdf musicretaildistribution
HershAggregator (2).pdf musicretaildistributionHershAggregator (2).pdf musicretaildistribution
HershAggregator (2).pdf musicretaildistribution
hershtara1
 
Lagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdfLagos School of Programming Final Project Updated.pdf
Lagos School of Programming Final Project Updated.pdf
benuju2016
 
TOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdf
TOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdfTOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdf
TOAE201-Slides-Chapter 4. Sample theoretical basis (1).pdf
NhiV747372
 
Process Mining as Enabler for Digital Transformations
Process Mining as Enabler for Digital TransformationsProcess Mining as Enabler for Digital Transformations
Process Mining as Enabler for Digital Transformations
Process mining Evangelist
 
hersh's midterm project.pdf music retail and distribution
hersh's midterm project.pdf music retail and distributionhersh's midterm project.pdf music retail and distribution
hersh's midterm project.pdf music retail and distribution
hershtara1
 
Automated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptxAutomated Melanoma Detection via Image Processing.pptx
Automated Melanoma Detection via Image Processing.pptx
handrymaharjan23
 
Sets theories and applications that can used to imporve knowledge
Sets theories and applications that can used to imporve knowledgeSets theories and applications that can used to imporve knowledge
Sets theories and applications that can used to imporve knowledge
saumyasl2020
 
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
indonesia-gen-z-report-2024 Gen Z (born between 1997 and 2012) is currently t...
disnakertransjabarda
 
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
文凭证书美国SDSU文凭圣地亚哥州立大学学生证学历认证查询
Taqyea
 
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial IntelligenceDr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug - Expert In Artificial Intelligence
Dr. Robert Krug
 

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>
  翻译: