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

PPT
Lecture 2.ppt
PPT
Response Tables.ppt
PPSX
Computer language - Html tables
PPTX
Table in MS Frontpage 2003
PPTX
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
PPTX
RDBMS oracle function RDBMSRDBMSRDBMS.pptx
PPTX
Table structure introduction
PPTX
HTML Tables in Omeka
Lecture 2.ppt
Response Tables.ppt
Computer language - Html tables
Table in MS Frontpage 2003
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
RDBMS oracle function RDBMSRDBMSRDBMS.pptx
Table structure introduction
HTML Tables in Omeka

Similar to 2. HTML Tables.ppt (20)

PDF
Chapterrrrrrrrrrr_10_Building Tables.pdf
PPTX
Presentation (2).pptx
PPTX
WEP4 and 5.pptx
PPTX
Web design - Working with tables in HTML
PPT
HTML Tables.ppt
PPTX
Html table
PPTX
Web topic 12 tables in html
PPTX
Html tables
PDF
Html tables
PPTX
HTML Tables
PPTX
HTML-Tables-A-Comprehensive-Guide (1).pptx
PDF
HTML TABLES
DOCX
table html web programing
PPTX
Method of creating table using HTML.pptx
PPTX
PPTX
Images and Tables in HTML
PPTX
Tables
PPTX
html-table
PPTX
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
PPTX
A PPT on Creation of Tables in HTML, WEB Designing
Chapterrrrrrrrrrr_10_Building Tables.pdf
Presentation (2).pptx
WEP4 and 5.pptx
Web design - Working with tables in HTML
HTML Tables.ppt
Html table
Web topic 12 tables in html
Html tables
Html tables
HTML Tables
HTML-Tables-A-Comprehensive-Guide (1).pptx
HTML TABLES
table html web programing
Method of creating table using HTML.pptx
Images and Tables in HTML
Tables
html-table
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
A PPT on Creation of Tables in HTML, WEB Designing
Ad

More from MuhammadRehan856177 (9)

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

Recently uploaded (20)

PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
PPT on Performance Review to get promotions
PDF
composite construction of structures.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Artificial Intelligence
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
737-MAX_SRG.pdf student reference guides
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Well-logging-methods_new................
PPTX
additive manufacturing of ss316l using mig welding
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
bas. eng. economics group 4 presentation 1.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT on Performance Review to get promotions
composite construction of structures.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Model Code of Practice - Construction Work - 21102022 .pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
R24 SURVEYING LAB MANUAL for civil enggi
Artificial Intelligence
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
III.4.1.2_The_Space_Environment.p pdffdf
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
737-MAX_SRG.pdf student reference guides
CYBER-CRIMES AND SECURITY A guide to understanding
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Well-logging-methods_new................
additive manufacturing of ss316l using mig welding
Automation-in-Manufacturing-Chapter-Introduction.pdf

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