SlideShare a Scribd company logo
4
Most read
9
Most read
11
Most read
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

PDF
Html table tags
PDF
Pengelolaan Konten di Media Sosial (1st session)
PDF
Privasi dan Keamanan Internet
PPTX
Computer Network
PPTX
Data representation
PPTX
CPU (Central Processing Units)
PPT
Environmental Ethics _ 2022 .ppt
PPTX
Grade 8 COMPUTER
Html table tags
Pengelolaan Konten di Media Sosial (1st session)
Privasi dan Keamanan Internet
Computer Network
Data representation
CPU (Central Processing Units)
Environmental Ethics _ 2022 .ppt
Grade 8 COMPUTER

What's hot (20)

PPTX
HTML: Tables and Forms
PPTX
PPTX
Html links
PPTX
Html form tag
PDF
Html text and formatting
PPT
PPT on Basic HTML Tags
PPTX
Html Table
PPTX
Anchor tag HTML Presentation
PPT
Hyperlinks in HTML
PPTX
html-table
PDF
Introduction to html
PPTX
Html ppt
PPTX
Html n CSS
PPTX
Introduction to HTML
PPTX
An Overview of HTML, CSS & Java Script
PPT
Introduction to JavaScript
PPTX
Basic html structure
PPTX
Basic Html Knowledge for students
PDF
Html frames
PDF
HTML CSS Basics
HTML: Tables and Forms
Html links
Html form tag
Html text and formatting
PPT on Basic HTML Tags
Html Table
Anchor tag HTML Presentation
Hyperlinks in HTML
html-table
Introduction to html
Html ppt
Html n CSS
Introduction to HTML
An Overview of HTML, CSS & Java Script
Introduction to JavaScript
Basic html structure
Basic Html Knowledge for students
Html frames
HTML CSS Basics
Ad

Viewers also liked (7)

PPTX
Web html table tags
PPT
Tables frames
PDF
Html tables examples
PDF
HTML practicals
PPTX
html5.ppt
PPTX
Take Better Care of Library Data and Spreadsheets with Google Visualization A...
PDF
Introduction to spreadsheets
Web html table tags
Tables frames
Html tables examples
HTML practicals
html5.ppt
Take Better Care of Library Data and Spreadsheets with Google Visualization A...
Introduction to spreadsheets
Ad

Similar to HTML Tables (20)

PPTX
Tables
PPTX
PPT
HTMLTables.ppt
PPTX
Html tables
PPT
HTML Tables.ppt
PPTX
Method of creating table using HTML.pptx
PPTX
Method of creating table using HTML.pptx
PPTX
Table structure introduction
DOCX
METHODS OF CUTTING COPYING HTML BASIC NOTES
PPTX
WEP4 and 5.pptx
PPTX
Web design - Working with tables in HTML
PDF
4-Tables in HTMLhtml tavle table in the html
PPT
Lecture 2.ppt
PDF
ClasServer-Side Development 2: Node.jss08 .pdf
PPT
Excel lesson 1
PPTX
Chapter 8: Tables
PDF
Web I - 03 - Tables
PPTX
htmltables-180721142906-1.pptx
PPTX
Information Technology CSEC: Spreadsheet
PDF
Chapterrrrrrrrrrr_10_Building Tables.pdf
Tables
HTMLTables.ppt
Html tables
HTML Tables.ppt
Method of creating table using HTML.pptx
Method of creating table using HTML.pptx
Table structure introduction
METHODS OF CUTTING COPYING HTML BASIC NOTES
WEP4 and 5.pptx
Web design - Working with tables in HTML
4-Tables in HTMLhtml tavle table in the html
Lecture 2.ppt
ClasServer-Side Development 2: Node.jss08 .pdf
Excel lesson 1
Chapter 8: Tables
Web I - 03 - Tables
htmltables-180721142906-1.pptx
Information Technology CSEC: Spreadsheet
Chapterrrrrrrrrrr_10_Building Tables.pdf

More from Nisa Soomro (16)

PPTX
PHP Cookies and Sessions
PPTX
Form Handling using PHP
PPTX
Connecting to my sql using PHP
PPTX
Basic of PHP
PPTX
PHP Filing
PPTX
PPTX
HTML Basic Tags
PPTX
HTML Forms
PPTX
HTML Frameset & Inline Frame
PPTX
HTML Images
PPTX
HTML Lists & Llinks
PPTX
Html5 SVG
PPTX
Html5 Canvas Detail
PPTX
Html5 canvas
PPTX
PPTX
Web programming lec#3
PHP Cookies and Sessions
Form Handling using PHP
Connecting to my sql using PHP
Basic of PHP
PHP Filing
HTML Basic Tags
HTML Forms
HTML Frameset & Inline Frame
HTML Images
HTML Lists & Llinks
Html5 SVG
Html5 Canvas Detail
Html5 canvas
Web programming lec#3

Recently uploaded (20)

PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Cell Structure & Organelles in detailed.
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Insiders guide to clinical Medicine.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Anesthesia in Laparoscopic Surgery in India
Renaissance Architecture: A Journey from Faith to Humanism
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pre independence Education in Inndia.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Week 4 Term 3 Study Techniques revisited.pptx
Cell Structure & Organelles in detailed.
human mycosis Human fungal infections are called human mycosis..pptx
O7-L3 Supply Chain Operations - ICLT Program
O5-L3 Freight Transport Ops (International) V1.pdf
Cell Types and Its function , kingdom of life
TR - Agricultural Crops Production NC III.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
PPH.pptx obstetrics and gynecology in nursing
102 student loan defaulters named and shamed – Is someone you know on the list?
Microbial diseases, their pathogenesis and prophylaxis
Insiders guide to clinical Medicine.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx

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