SlideShare a Scribd company logo
3
Most read
4
Most read
6
Most read
H T M L
T AB L E S
E X P L A I NE D
Author: M.Muzaffar Hameed
What is a TABLE?
• The HTML table allows web designers to
arrange & organize data -- text, images,
hyperlinks, forms, form fields, other tables, etc.
• Tables are made up of rows and columns.
--Rows are horizontally arranged cells
--Columns are vertically arranged cells
1 ROW
1 COLUMN
Author: M.Muzaffar Hameed
TABLE: Components
• Basic HTML table tags:
o <table></table> required
oDefines the beginning and end of the table
o <tr></tr> required
oTable Row - Defines the beginning and end of a
horizontal row.
o <td></td> required
oTable Cell - Defines an individual cell. Cells are always
placed inside a row. “td” stands for table data.
Code
<table>
<tr><td>1</td><td>2</td></tr>
<tr><td>3</td><td>4</td></tr>
</table>
1 2
3 4
Browser View
Author: M.Muzaffar Hameed
TABLE: Components Cont.
• Additional HTML table tags:
o <th></th> optional
o Defines a table header row. Used instead of “td.”
o Text is bold & centered within the cell
o <caption></caption> optional
o Sets a caption for the table. Goes after the table tag but
not inside “tr” or “td.” There should be only one caption
per table. Appears centered above the table.
Code
<table>
<caption>My Schedule</caption>
<tr><th>Period</th><th>Class</th></tr>
<tr><td>1st</td><td>PE</td></tr>
<tr><td>2nd</td><td>Math</td></tr>
</table>
Period Class
1st PE
2nd Math
Browser View
My Schedule
Author: M.Muzaffar Hameed
TABLE: Tag attributes
• Attributes that can be added to table tags:
o Table Border optional
o Table border attribute dictates border thickness
o Example: <table border=“1”>
o 0 = no border & larger numbers = thicker borders
o No border defined = no border viewable
o bordercolor can be added to change the color of the
table border. Border must be >0 to see the color
o Example: <table border=“1” bordercolor=“red”>
o Table Width & Height optional
o Width & Height can be defined in the open table tag
o Example: <table width=“100” height=“100”>
o The height attribute is widely supported, but isn't actually
part of the official HTML standard. It may not always work
as you expect.
o If no size values are specified, the browser will decide on
an appropriate size. Results will vary between browsers.
Author: M.Muzaffar Hameed
TABLE: Tag attributes cont.
• Additional attributes that can be added to table tags:
o Cell Padding optional
o Defines the space inside each cell, i.e. the space
between the edges of the cell and the
content within it.
o Example: <table border=“1”
cellpadding=“10” bordercolor=“red”>
o Cell Spacing optional
o Defines the space between cells. If a border is used, the
spacing will widen the border.
o Example:
<table border=“1” cellspacing=“10”
bordercolor=“green”>
o These attributes apply to the entire table - you can't specify
spacing or padding for individual cells.
Author: M.Muzaffar Hameed
TABLE: Tag attributes cont.
• Attributes that can be added to th, tr, & td tags:
o Alignment optional
o Alignment can be added to the table, tr, th, & td tag.
o If applied to the table tag, the entire table will align.
o If applied to the tr tag, the entire row will align.
o If applied to the th or td tag, just the cell will align.
o Alignment options: left, center, & right
o Contents will left align by default
Code
<table border=“1”><tr align=“right”>
<td>Test1</td><td>Test2</td></tr><tr>
<td>Test3</td><td>Test4</td></tr></table>
o Column & Row span optional
o Column span (colspan) is added to a th or td tag
o Row span (rowspan) can added to the tr tag
Code
<table><tr><td colspan=2>Heading</td></tr>
<tr><td>Entry1</td><td>Entry2</td></tr></table>
Browser View
Test1 Test2
Test3 Test4
Browser View
Heading
Entry1 Entry2
Author: M.Muzaffar Hameed
REVIEW: HTML tables
Code
<table border=“10” bordercolor=“orange” cellspacing=“2” cellpadding=“3”
width=“500”> <caption>My Schedule</caption>
<tr><th>Period</th><th>Class</th></tr>
<tr><td align=“center”>1st</td> <td>Web Design</td></tr>
<tr><td align=“center”>2nd</td><td>Social Studies</td></tr>
<tr><td colspan=“2”>Lunch</td></tr>
<tr><td align=“center”>3rd</td><td>English</td></tr>
</table>
table
border
align
center
cell padding
cell
spacing
table
header
column
span
Browser View
Author: M.Muzaffar Hameed

More Related Content

Similar to 2. HTML Tables.ppt (20)

PDF
Chapterrrrrrrrrrr_10_Building Tables.pdf
ankitayadavay123
 
PPTX
Presentation (2).pptx
HardikMugvana
 
PPTX
WEP4 and 5.pptx
MLikithMahendra
 
PPTX
Web design - Working with tables in HTML
Mustafa Kamel Mohammadi
 
PPT
HTML Tables.ppt
ShararehShojaei1
 
PPTX
Html table
JayjZens
 
PPTX
Web topic 12 tables in html
CK Yang
 
PPTX
Html tables
Himanshu Pathak
 
PDF
Html tables
Sikandar Pandit
 
PPTX
HTML Tables
Nisa Soomro
 
PPTX
HTML-Tables-A-Comprehensive-Guide (1).pptx
rameshwaram744
 
PDF
HTML TABLES
RevathyP14
 
DOCX
table html web programing
lodhran-hayat
 
PPTX
Method of creating table using HTML.pptx
mkrv0617
 
PPTX
Html tables
Jagruti Ghadigaonkar
 
PPTX
Images and Tables in HTML
Aarti P
 
PPTX
Tables
savitamhaske
 
PPTX
html-table
Dhirendra Chauhan
 
PPTX
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
Orin18
 
PPTX
A PPT on Creation of Tables in HTML, WEB Designing
GuthulaPradeep
 
Chapterrrrrrrrrrr_10_Building Tables.pdf
ankitayadavay123
 
Presentation (2).pptx
HardikMugvana
 
WEP4 and 5.pptx
MLikithMahendra
 
Web design - Working with tables in HTML
Mustafa Kamel Mohammadi
 
HTML Tables.ppt
ShararehShojaei1
 
Html table
JayjZens
 
Web topic 12 tables in html
CK Yang
 
Html tables
Himanshu Pathak
 
Html tables
Sikandar Pandit
 
HTML Tables
Nisa Soomro
 
HTML-Tables-A-Comprehensive-Guide (1).pptx
rameshwaram744
 
HTML TABLES
RevathyP14
 
table html web programing
lodhran-hayat
 
Method of creating table using HTML.pptx
mkrv0617
 
Images and Tables in HTML
Aarti P
 
Tables
savitamhaske
 
html-table
Dhirendra Chauhan
 
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
Orin18
 
A PPT on Creation of Tables in HTML, WEB Designing
GuthulaPradeep
 

More from MuhammadRehan856177 (9)

PPTX
Lecture 10.pptx
MuhammadRehan856177
 
PPT
Event Programming JavaScript
MuhammadRehan856177
 
PPT
Intrusion .ppt
MuhammadRehan856177
 
PPTX
Botnets Attacks.pptx
MuhammadRehan856177
 
PPTX
Lecture 2.pptx
MuhammadRehan856177
 
PPTX
Lecture 3.pptx
MuhammadRehan856177
 
PPTX
Lecture 2.pptx
MuhammadRehan856177
 
PPT
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
PPT
3. HTML Forms.ppt
MuhammadRehan856177
 
Lecture 10.pptx
MuhammadRehan856177
 
Event Programming JavaScript
MuhammadRehan856177
 
Intrusion .ppt
MuhammadRehan856177
 
Botnets Attacks.pptx
MuhammadRehan856177
 
Lecture 2.pptx
MuhammadRehan856177
 
Lecture 3.pptx
MuhammadRehan856177
 
Lecture 2.pptx
MuhammadRehan856177
 
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
3. HTML Forms.ppt
MuhammadRehan856177
 
Ad

Recently uploaded (20)

PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPT
Electrical Safety Presentation for Basics Learning
AliJaved79382
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PPT
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
smart lot access control system with eye
rasabzahra
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
MRRS Strength and Durability of Concrete
CivilMythili
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Electrical Safety Presentation for Basics Learning
AliJaved79382
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
smart lot access control system with eye
rasabzahra
 
Ad

2. HTML Tables.ppt

  • 1. H T M L T AB L E S E X P L A I NE D Author: M.Muzaffar Hameed
  • 2. What is a TABLE? • The HTML table allows web designers to arrange & organize data -- text, images, hyperlinks, forms, form fields, other tables, etc. • Tables are made up of rows and columns. --Rows are horizontally arranged cells --Columns are vertically arranged cells 1 ROW 1 COLUMN Author: M.Muzaffar Hameed
  • 3. TABLE: Components • Basic HTML table tags: o <table></table> required oDefines the beginning and end of the table o <tr></tr> required oTable Row - Defines the beginning and end of a horizontal row. o <td></td> required oTable Cell - Defines an individual cell. Cells are always placed inside a row. “td” stands for table data. Code <table> <tr><td>1</td><td>2</td></tr> <tr><td>3</td><td>4</td></tr> </table> 1 2 3 4 Browser View Author: M.Muzaffar Hameed
  • 4. TABLE: Components Cont. • Additional HTML table tags: o <th></th> optional o Defines a table header row. Used instead of “td.” o Text is bold & centered within the cell o <caption></caption> optional o Sets a caption for the table. Goes after the table tag but not inside “tr” or “td.” There should be only one caption per table. Appears centered above the table. Code <table> <caption>My Schedule</caption> <tr><th>Period</th><th>Class</th></tr> <tr><td>1st</td><td>PE</td></tr> <tr><td>2nd</td><td>Math</td></tr> </table> Period Class 1st PE 2nd Math Browser View My Schedule Author: M.Muzaffar Hameed
  • 5. TABLE: Tag attributes • Attributes that can be added to table tags: o Table Border optional o Table border attribute dictates border thickness o Example: <table border=“1”> o 0 = no border & larger numbers = thicker borders o No border defined = no border viewable o bordercolor can be added to change the color of the table border. Border must be >0 to see the color o Example: <table border=“1” bordercolor=“red”> o Table Width & Height optional o Width & Height can be defined in the open table tag o Example: <table width=“100” height=“100”> o The height attribute is widely supported, but isn't actually part of the official HTML standard. It may not always work as you expect. o If no size values are specified, the browser will decide on an appropriate size. Results will vary between browsers. Author: M.Muzaffar Hameed
  • 6. TABLE: Tag attributes cont. • Additional attributes that can be added to table tags: o Cell Padding optional o Defines the space inside each cell, i.e. the space between the edges of the cell and the content within it. o Example: <table border=“1” cellpadding=“10” bordercolor=“red”> o Cell Spacing optional o Defines the space between cells. If a border is used, the spacing will widen the border. o Example: <table border=“1” cellspacing=“10” bordercolor=“green”> o These attributes apply to the entire table - you can't specify spacing or padding for individual cells. Author: M.Muzaffar Hameed
  • 7. TABLE: Tag attributes cont. • Attributes that can be added to th, tr, & td tags: o Alignment optional o Alignment can be added to the table, tr, th, & td tag. o If applied to the table tag, the entire table will align. o If applied to the tr tag, the entire row will align. o If applied to the th or td tag, just the cell will align. o Alignment options: left, center, & right o Contents will left align by default Code <table border=“1”><tr align=“right”> <td>Test1</td><td>Test2</td></tr><tr> <td>Test3</td><td>Test4</td></tr></table> o Column & Row span optional o Column span (colspan) is added to a th or td tag o Row span (rowspan) can added to the tr tag Code <table><tr><td colspan=2>Heading</td></tr> <tr><td>Entry1</td><td>Entry2</td></tr></table> Browser View Test1 Test2 Test3 Test4 Browser View Heading Entry1 Entry2 Author: M.Muzaffar Hameed
  • 8. REVIEW: HTML tables Code <table border=“10” bordercolor=“orange” cellspacing=“2” cellpadding=“3” width=“500”> <caption>My Schedule</caption> <tr><th>Period</th><th>Class</th></tr> <tr><td align=“center”>1st</td> <td>Web Design</td></tr> <tr><td align=“center”>2nd</td><td>Social Studies</td></tr> <tr><td colspan=“2”>Lunch</td></tr> <tr><td align=“center”>3rd</td><td>English</td></tr> </table> table border align center cell padding cell spacing table header column span Browser View Author: M.Muzaffar Hameed