SlideShare a Scribd company logo
1 of 18
nisa1207@gmail.com 
Prog_nisa@quest.edu.pk
Table 
•How tables are used 
• Basic table structure 
• The importance of headers 
• Spanning rows and columns 
• Cell padding and spacing 
• Making tables accessible 
2
HTML tables were created for instances when you need to add 
tabular material (data arranged into rows and columns) to a web 
page. Tables may be used to organize calendars, schedules, 
statistics, or other types of information. 
Note that “data” doesn’t necessarilymean numbers. 
A table cell may contain any sort of information, including 
numbers, text elements, and even images andmultimedia objects. 
3
<table>...</table> : Tabular content (rows and columns) 
<tr>...</tr> Table row 
<th>...</th> Table header 
<td>...</td> Table cell data 
4
5
All of the table’s content goes into cells that are 
arranged into rows. Cells contain either header 
information (titles for the columns, such as 
“Calories”) or data, which may be any sort of 
content. 
6
7
8 
shows the elements that identify the table (table), rows 
(tr, for table row”), and cells (th, for “table headers,” and 
td, for “table data”). 
Cells are the heart of the table, because that’s where the 
actual content goes. The other elements just hold things 
together.
9 
What we don’t see are column elements (see note). The 
number of columns in a table is determined by the 
number of cells in each row. This is one of the things that 
make HTML tables potentially tricky. Rows are easy—if 
you want the table to have three rows, just use three tr 
elements. Columns are different. For a table with four 
columns, you need to make sure that every row has four 
td or th elements; the columns are implied.
Remember, all the 
content must go in 
cells, that is, within 
td or th elements. 
You can put any 
content in a cell: text, 
a graphic, even 
another table. 
10
Attribute Purpose 
Align To align table i.e left, right and center 
Bgcolor Change the background color 
Border To use border 
Cellspacing To create space between the Cells 
Cellpadding To create space between content and border 
Colspan 
rowspan 
Width To define the width of table, value can be defined in Pixels or %. 
11
the text marked up as headers (th elements) is displayed 
differently from the other cells in the table (td elements). The 
difference, however, is not purely cosmetic. Table headers are 
important because they provide information or context about the 
cells in the row or column they precede. The th element may be 
handled differently than tds by alternative browsing devices. For 
example, screen readers may read the header aloud before each 
data cell. 
Note:don’t avoid using th elements because of their default 
rendering (bold and centered). 
12
13 
How can we 
differentiate 
between td 
and th?
One fundamental feature of table structure is cell spanning, 
which is the stretching of a cell to cover several rows or columns. 
Spanning cells allows you to create complex table structures, but 
it has the side effect of making the markup a little more difficult 
to keep track of. You make a header or data cell span by adding 
the colspan or rowspan attributes 
14
Column spans, created with the colspan attribute in the td or th element, 
stretch a cell to the right to span over the subsequent columns. 
<table> 
<tr> 
<th colspan="2">Fat</th> 
</tr> 
<tr> 
<td>Saturated Fat (g)</td> 
<td>Unsaturated Fat (g)</td> 
</tr> 
</table> 15
Row spans, created with the rowspan attribute, work just like 
column spans, but they cause the cell to span downward over 
several rows. 
16
By default, cells are sized just large enough to fit their contents, but often 
you’ll want to add a little breathing room around tabular content. 
Cell padding is the space inside the cell, between the content and the edge of 
the cell. 
Cell spacing, the area between cells, is a little more complicated. 
17
18

More Related Content

What's hot

Html heading
Html headingHtml heading
Html heading
saichii27
 

What's hot (20)

html-table
html-tablehtml-table
html-table
 
Html heading
Html headingHtml heading
Html heading
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Html introduction
Html introductionHtml introduction
Html introduction
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
html-css
html-csshtml-css
html-css
 
Html n CSS
Html n CSSHtml n CSS
Html n CSS
 
HTML
HTMLHTML
HTML
 
Html ppt
Html pptHtml ppt
Html ppt
 
CSS Grid
CSS GridCSS Grid
CSS Grid
 
Css borders
Css bordersCss borders
Css borders
 
Php forms
Php formsPhp forms
Php forms
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
Html
HtmlHtml
Html
 
Intro to html 5
Intro to html 5Intro to html 5
Intro to html 5
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
HTML-5 New Input Types
HTML-5 New Input TypesHTML-5 New Input Types
HTML-5 New Input Types
 
Html table tags
Html table tagsHtml table tags
Html table tags
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 

Viewers also liked (6)

Tables frames
Tables framesTables frames
Tables frames
 
Html tables examples
Html tables   examplesHtml tables   examples
Html tables examples
 
HTML practicals
HTML practicals HTML practicals
HTML practicals
 
html5.ppt
html5.ppthtml5.ppt
html5.ppt
 
Take Better Care of Library Data and Spreadsheets with Google Visualization A...
Take Better Care of Library Data and Spreadsheets with Google Visualization A...Take Better Care of Library Data and Spreadsheets with Google Visualization A...
Take Better Care of Library Data and Spreadsheets with Google Visualization A...
 
Introduction to spreadsheets
Introduction to spreadsheetsIntroduction to spreadsheets
Introduction to spreadsheets
 

Similar to HTML Tables

4-Tables in HTMLhtml tavle table in the html
4-Tables in HTMLhtml tavle table in the html4-Tables in HTMLhtml tavle table in the html
4-Tables in HTMLhtml tavle table in the html
SajidHussainS
 
Excel lesson 1
Excel lesson 1Excel lesson 1
Excel lesson 1
spirax1681
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagrams
clement swarnappa
 
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
 

Similar to HTML Tables (20)

Tables
TablesTables
Tables
 
Html tables
Html tablesHtml tables
Html tables
 
HTMLTables.ppt
HTMLTables.pptHTMLTables.ppt
HTMLTables.ppt
 
Html tables
Html tablesHtml tables
Html tables
 
HTML Tables.ppt
HTML Tables.pptHTML Tables.ppt
HTML Tables.ppt
 
Table structure introduction
Table structure introductionTable structure introduction
Table structure introduction
 
WEP4 and 5.pptx
WEP4 and 5.pptxWEP4 and 5.pptx
WEP4 and 5.pptx
 
Web design - Working with tables in HTML
Web design - Working with tables in HTMLWeb design - Working with tables in HTML
Web design - Working with tables in HTML
 
4-Tables in HTMLhtml tavle table in the html
4-Tables in HTMLhtml tavle table in the html4-Tables in HTMLhtml tavle table in the html
4-Tables in HTMLhtml tavle table in the html
 
Lecture 2.ppt
Lecture 2.pptLecture 2.ppt
Lecture 2.ppt
 
Excel lesson 1
Excel lesson 1Excel lesson 1
Excel lesson 1
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
 
Web I - 03 - Tables
Web I - 03 - TablesWeb I - 03 - Tables
Web I - 03 - Tables
 
htmltables-180721142906-1.pptx
htmltables-180721142906-1.pptxhtmltables-180721142906-1.pptx
htmltables-180721142906-1.pptx
 
HTML Tables in Omeka
HTML Tables in OmekaHTML Tables in Omeka
HTML Tables in Omeka
 
Computer language - Html tables
Computer language - Html tablesComputer language - Html tables
Computer language - Html tables
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagrams
 
Html tables
Html tablesHtml tables
Html tables
 
Response Tables.ppt
Response Tables.pptResponse Tables.ppt
Response Tables.ppt
 
Web topic 12 tables in html
Web topic 12  tables in htmlWeb topic 12  tables in html
Web topic 12 tables in html
 

More from Nisa Soomro (17)

PHP Cookies and Sessions
PHP Cookies and SessionsPHP Cookies and Sessions
PHP Cookies and Sessions
 
Form Handling using PHP
Form Handling using PHPForm Handling using PHP
Form Handling using PHP
 
Connecting to my sql using PHP
Connecting to my sql using PHPConnecting to my sql using PHP
Connecting to my sql using PHP
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
PHP Filing
PHP Filing PHP Filing
PHP Filing
 
Html5
Html5Html5
Html5
 
HTML Basic Tags
HTML Basic Tags HTML Basic Tags
HTML Basic Tags
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
HTML Frameset & Inline Frame
HTML Frameset & Inline FrameHTML Frameset & Inline Frame
HTML Frameset & Inline Frame
 
HTML Images
HTML Images HTML Images
HTML Images
 
HTML Lists & Llinks
HTML Lists & LlinksHTML Lists & Llinks
HTML Lists & Llinks
 
Html5 SVG
Html5 SVGHtml5 SVG
Html5 SVG
 
Html5 Canvas Detail
Html5 Canvas DetailHtml5 Canvas Detail
Html5 Canvas Detail
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
Html5
Html5Html5
Html5
 
Html
HtmlHtml
Html
 
Web programming lec#3
Web programming lec#3Web programming lec#3
Web programming lec#3
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

HTML Tables

  • 2. Table •How tables are used • Basic table structure • The importance of headers • Spanning rows and columns • Cell padding and spacing • Making tables accessible 2
  • 3. HTML tables were created for instances when you need to add tabular material (data arranged into rows and columns) to a web page. Tables may be used to organize calendars, schedules, statistics, or other types of information. Note that “data” doesn’t necessarilymean numbers. A table cell may contain any sort of information, including numbers, text elements, and even images andmultimedia objects. 3
  • 4. <table>...</table> : Tabular content (rows and columns) <tr>...</tr> Table row <th>...</th> Table header <td>...</td> Table cell data 4
  • 5. 5
  • 6. All of the table’s content goes into cells that are arranged into rows. Cells contain either header information (titles for the columns, such as “Calories”) or data, which may be any sort of content. 6
  • 7. 7
  • 8. 8 shows the elements that identify the table (table), rows (tr, for table row”), and cells (th, for “table headers,” and td, for “table data”). Cells are the heart of the table, because that’s where the actual content goes. The other elements just hold things together.
  • 9. 9 What we don’t see are column elements (see note). The number of columns in a table is determined by the number of cells in each row. This is one of the things that make HTML tables potentially tricky. Rows are easy—if you want the table to have three rows, just use three tr elements. Columns are different. For a table with four columns, you need to make sure that every row has four td or th elements; the columns are implied.
  • 10. Remember, all the content must go in cells, that is, within td or th elements. You can put any content in a cell: text, a graphic, even another table. 10
  • 11. Attribute Purpose Align To align table i.e left, right and center Bgcolor Change the background color Border To use border Cellspacing To create space between the Cells Cellpadding To create space between content and border Colspan rowspan Width To define the width of table, value can be defined in Pixels or %. 11
  • 12. the text marked up as headers (th elements) is displayed differently from the other cells in the table (td elements). The difference, however, is not purely cosmetic. Table headers are important because they provide information or context about the cells in the row or column they precede. The th element may be handled differently than tds by alternative browsing devices. For example, screen readers may read the header aloud before each data cell. Note:don’t avoid using th elements because of their default rendering (bold and centered). 12
  • 13. 13 How can we differentiate between td and th?
  • 14. One fundamental feature of table structure is cell spanning, which is the stretching of a cell to cover several rows or columns. Spanning cells allows you to create complex table structures, but it has the side effect of making the markup a little more difficult to keep track of. You make a header or data cell span by adding the colspan or rowspan attributes 14
  • 15. Column spans, created with the colspan attribute in the td or th element, stretch a cell to the right to span over the subsequent columns. <table> <tr> <th colspan="2">Fat</th> </tr> <tr> <td>Saturated Fat (g)</td> <td>Unsaturated Fat (g)</td> </tr> </table> 15
  • 16. Row spans, created with the rowspan attribute, work just like column spans, but they cause the cell to span downward over several rows. 16
  • 17. By default, cells are sized just large enough to fit their contents, but often you’ll want to add a little breathing room around tabular content. Cell padding is the space inside the cell, between the content and the edge of the cell. Cell spacing, the area between cells, is a little more complicated. 17
  • 18. 18