SlideShare a Scribd company logo
Web Design Principles
5th
Edition
Chapter Ten
Working with Data Tables
Objectives
When you complete this chapter, you will be able to:
• Use table elements
• Use table headers and footers
• Group columns
• Style table borders
• Apply padding, margins, and floats to tables
• Style table background colors
• Apply table styles
2Web Design Principles 5th
Ed.
Using Table Elements
4
Using Table Elements
• The HTML table elements allow the
arrangement of data into rows of cells and
columns
• The table element <table> contains the table
information, which consists of:
– Header element <th>
– Row element <tr>
– Data cell alignment <td>
Web Design Principles 5th
Ed.
5Web Design Principles 5th
Ed.
6Web Design Principles 5th
Ed.
Collapsing Table Borders
• Tables are more legible with the table borders
collapsed
• Use the border-collapsed property
table {border-collapse: collapse;}
7Web Design Principles 5th
Ed.
8Web Design Principles 5th
Ed.
Spanning Rows
• The rowspan attribute lets you create cells that
span multiple rows
<td class="title" rowspan="6">
Best-Selling Albums Worldwide</td>
9Web Design Principles 5th
Ed.
10Web Design Principles 5th
Ed.
Using Table Headers and Footers
Using Table Headers and Footers
• Rows can be grouped into head, body, and footer
sections using the <thead>, <tbody>, and <tfoot>
elements
• You can style these table sections with CSS
12Web Design Principles 5th
Ed.
Using Table Headers and Footers
thead {
font-family: arial;
background-color: #ccddee;
}
tfoot {
background-color: #ddccee;
font-family: times, serif;
font-size: .9em;
font-style: italic;
}
13Web Design Principles 5th
Ed.
14Web Design Principles 5th
Ed.
Grouping Columns
Grouping Columns
• The <colgroup> and <col> elements allow you to
apply style characteristics to groups of columns or
individual columns
• The <colgroup> element has a span attribute that
lets you set the number of columns specified in the
group
• The <col> element lets you specify style
characteristics for individual columns
16Web Design Principles 5th
Ed.
17Web Design Principles 5th
Ed.
18Web Design Principles 5th
Ed.
Styling the Caption
• You can position the caption on the top or bottom
of the table using the caption-site property
• You can also apply other style properties to
enhance the caption text:
caption {text-align: left;
font-style: italic;
padding-bottom: 10px;
}
19Web Design Principles 5th
Ed.
20Web Design Principles 5th
Ed.
Styling Table Borders
Styling Table Borders
• By default, table borders are turned off
• You can add borders using CSS
• Borders can be applied to the whole table, to
individual rows, and to individual cells
22Web Design Principles 5th
Ed.
Styling Table Borders
• To create a table with an outside border only:
table {
border: solid 1px black;
border-collapse: collapse;
}
23Web Design Principles 5th
Ed.
24Web Design Principles 5th
Ed.
Styling Table Borders
• To specify borders for each cell, use a separate
style rule:
table {
border: solid 1px black;
border-collapse: collapse;
}
th, td {
border: solid 1px black;
}
25Web Design Principles 5th
Ed.
26Web Design Principles 5th
Ed.
Styling Table Borders
• You can also style individual rows or cells and
apply cell borders
th {
border-bottom: solid thick blue;
background-color: #ccddee;
}
27Web Design Principles 5th
Ed.
28Web Design Principles 5th
Ed.
Applying Padding, Margins, and
Floats to Tables
Using Padding
• You can enhance the legibility of your table data
with padding
• This style rule adds five pixels of padding to both
types of table data elements
th, td {padding: 5px;}
30Web Design Principles 5th
Ed.
31Web Design Principles 5th
Ed.
Using Margins and Floats
• Tables can be floated
• Use margins to add white space around floating
tables
table.best {
font-family: verdana;
border: solid 1px black;
border-collapse: collapse;
float: left;
margin-right: 20px;
margin-bottom: 10px;
}
32Web Design Principles 5th
Ed.
33Web Design Principles 5th
Ed.
Styling Table Background Colors
Styling Table Background Colors
• You can apply background colors to:
– Entire table
– Single rows or cells
– Column groups of individual columns
• You can alternate colors for different rows
• Add hover interactions
35Web Design Principles 5th
Ed.
36Web Design Principles 5th
Ed.
Creating Alternate Color Rows
• Table data is easier to read when alternate rows
have a distinguishing background color
• Write a style rule for the odd or even row using a
class selector
tr.odd td {background-color: #eaead5;}
37Web Design Principles 5th
Ed.
38Web Design Principles 5th
Ed.
Creating Background Hover Effects
• You can add interactivity to your table with hover
effects
• When the user hovers the pointer over a cell or
row, the formatting can change
td:hover {
color: white;
background-color: #722750;
}
39Web Design Principles 5th
Ed.
40Web Design Principles 5th
Ed.
Summary
• Use tables for presentation of data, not for page
layout
• Use the grouping elements to apply styles to
groups of rows or columns or to the header, body,
and footer of a table
• Apply borders to both the <table> and cell (<th>
and <td>) elements to display a table border on the
entire table
• Use the border-collapse property to make table
data more legible
41Web Design Principles 5th
Ed.
Summary
• Always use CSS to add presentation style to tables
• Use padding to add space within your cells to make
your data more legible
• You can float tables and add margins with the box
model properties
• Specify background colors or hovers to aid in the
legibility of your data
42Web Design Principles 5th
Ed.

More Related Content

Viewers also liked

2 кл
2 кл2 кл
En maint intro_long
En maint intro_longEn maint intro_long
En maint intro_long
Rashi Das
 
"Город на віконці"
"Город на віконці""Город на віконці"
"Город на віконці"Julja Chernenko
 
-
--
WHATSAPP MASIVO
WHATSAPP MASIVOWHATSAPP MASIVO
WHATSAPP MASIVO
Alejandro Kampelmacher
 
6 клас
6 клас6 клас
6 клас
Julja Chernenko
 
Graphic Design
Graphic DesignGraphic Design
Graphic Design
Joan McCullough
 
батьківські збори
батьківські зборибатьківські збори
батьківські збори
Julja Chernenko
 
Удивительный мир детства
Удивительный мир детстваУдивительный мир детства
Удивительный мир детстваGalinaVasilievna
 
херсон
херсонхерсон
херсон
Julja Chernenko
 
5 клас
5 клас5 клас
5 клас
Julja Chernenko
 
Personalisatie & ROI
Personalisatie & ROIPersonalisatie & ROI
Personalisatie & ROI
Reinout Wolfert
 
7 клас
7 клас7 клас
7 клас
Julja Chernenko
 
8 кл
8 кл8 кл
Intro to Class Dojo
Intro to Class DojoIntro to Class Dojo
Intro to Class Dojo
Joan McCullough
 
Табір "Подоляночка"
Табір  "Подоляночка" Табір  "Подоляночка"
Табір "Подоляночка"
Julja Chernenko
 
Табір "Веселка"
Табір "Веселка"Табір "Веселка"
Табір "Веселка"
Julja Chernenko
 
10 клас
10 клас10 клас
10 клас
Julja Chernenko
 
Sample Photos
Sample PhotosSample Photos
Sample Photos
Joan McCullough
 

Viewers also liked (19)

2 кл
2 кл2 кл
2 кл
 
En maint intro_long
En maint intro_longEn maint intro_long
En maint intro_long
 
"Город на віконці"
"Город на віконці""Город на віконці"
"Город на віконці"
 
-
--
-
 
WHATSAPP MASIVO
WHATSAPP MASIVOWHATSAPP MASIVO
WHATSAPP MASIVO
 
6 клас
6 клас6 клас
6 клас
 
Graphic Design
Graphic DesignGraphic Design
Graphic Design
 
батьківські збори
батьківські зборибатьківські збори
батьківські збори
 
Удивительный мир детства
Удивительный мир детстваУдивительный мир детства
Удивительный мир детства
 
херсон
херсонхерсон
херсон
 
5 клас
5 клас5 клас
5 клас
 
Personalisatie & ROI
Personalisatie & ROIPersonalisatie & ROI
Personalisatie & ROI
 
7 клас
7 клас7 клас
7 клас
 
8 кл
8 кл8 кл
8 кл
 
Intro to Class Dojo
Intro to Class DojoIntro to Class Dojo
Intro to Class Dojo
 
Табір "Подоляночка"
Табір  "Подоляночка" Табір  "Подоляночка"
Табір "Подоляночка"
 
Табір "Веселка"
Табір "Веселка"Табір "Веселка"
Табір "Веселка"
 
10 клас
10 клас10 клас
10 клас
 
Sample Photos
Sample PhotosSample Photos
Sample Photos
 

Similar to Ppt ch10

9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt
SimonChirambira
 
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
 
Ddpz2613 topic4 table
Ddpz2613 topic4 tableDdpz2613 topic4 table
Ddpz2613 topic4 table
Mohamad Sahiedan
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and Columns
Dr. Ahmed Al Zaidy
 
MIS 226: Chapter 4
MIS 226: Chapter 4MIS 226: Chapter 4
MIS 226: Chapter 4
macrob14
 
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
niruttisai
 
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
1geassking
 
Lesson 5 cs5
Lesson 5   cs5Lesson 5   cs5
Lesson 5 cs5
dtelepos
 
9781111528705_PPT_ch05.ppt
9781111528705_PPT_ch05.ppt9781111528705_PPT_ch05.ppt
9781111528705_PPT_ch05.ppt
SimonChirambira
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
elayelily
 
Ppt ch05
Ppt ch05Ppt ch05
Ppt ch05
niruttisai
 
Ppt ch05
Ppt ch05Ppt ch05
Ppt ch05
1geassking
 
9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt
SimonChirambira
 
9781111528705_PPT_ch09.ppt
9781111528705_PPT_ch09.ppt9781111528705_PPT_ch09.ppt
9781111528705_PPT_ch09.ppt
SimonChirambira
 
Layouts
Layouts Layouts
Layouts
kjkleindorfer
 
Ppt ch04
Ppt ch04Ppt ch04
Ppt ch04
1geassking
 
Ppt ch04
Ppt ch04Ppt ch04
Ppt ch04
niruttisai
 
Ppt ch09
Ppt ch09Ppt ch09
Ppt ch09
1geassking
 
Ppt ch09
Ppt ch09Ppt ch09
Ppt ch09
niruttisai
 
Excel Basics
Excel BasicsExcel Basics
Excel Basics
JovenilBacatan1
 

Similar to Ppt ch10 (20)

9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagrams
 
Ddpz2613 topic4 table
Ddpz2613 topic4 tableDdpz2613 topic4 table
Ddpz2613 topic4 table
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and Columns
 
MIS 226: Chapter 4
MIS 226: Chapter 4MIS 226: Chapter 4
MIS 226: Chapter 4
 
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
 
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
 
Lesson 5 cs5
Lesson 5   cs5Lesson 5   cs5
Lesson 5 cs5
 
9781111528705_PPT_ch05.ppt
9781111528705_PPT_ch05.ppt9781111528705_PPT_ch05.ppt
9781111528705_PPT_ch05.ppt
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
 
Ppt ch05
Ppt ch05Ppt ch05
Ppt ch05
 
Ppt ch05
Ppt ch05Ppt ch05
Ppt ch05
 
9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt
 
9781111528705_PPT_ch09.ppt
9781111528705_PPT_ch09.ppt9781111528705_PPT_ch09.ppt
9781111528705_PPT_ch09.ppt
 
Layouts
Layouts Layouts
Layouts
 
Ppt ch04
Ppt ch04Ppt ch04
Ppt ch04
 
Ppt ch04
Ppt ch04Ppt ch04
Ppt ch04
 
Ppt ch09
Ppt ch09Ppt ch09
Ppt ch09
 
Ppt ch09
Ppt ch09Ppt ch09
Ppt ch09
 
Excel Basics
Excel BasicsExcel Basics
Excel Basics
 

Recently uploaded

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 

Ppt ch10

  • 1. Web Design Principles 5th Edition Chapter Ten Working with Data Tables
  • 2. Objectives When you complete this chapter, you will be able to: • Use table elements • Use table headers and footers • Group columns • Style table borders • Apply padding, margins, and floats to tables • Style table background colors • Apply table styles 2Web Design Principles 5th Ed.
  • 4. 4 Using Table Elements • The HTML table elements allow the arrangement of data into rows of cells and columns • The table element <table> contains the table information, which consists of: – Header element <th> – Row element <tr> – Data cell alignment <td> Web Design Principles 5th Ed.
  • 7. Collapsing Table Borders • Tables are more legible with the table borders collapsed • Use the border-collapsed property table {border-collapse: collapse;} 7Web Design Principles 5th Ed.
  • 9. Spanning Rows • The rowspan attribute lets you create cells that span multiple rows <td class="title" rowspan="6"> Best-Selling Albums Worldwide</td> 9Web Design Principles 5th Ed.
  • 11. Using Table Headers and Footers
  • 12. Using Table Headers and Footers • Rows can be grouped into head, body, and footer sections using the <thead>, <tbody>, and <tfoot> elements • You can style these table sections with CSS 12Web Design Principles 5th Ed.
  • 13. Using Table Headers and Footers thead { font-family: arial; background-color: #ccddee; } tfoot { background-color: #ddccee; font-family: times, serif; font-size: .9em; font-style: italic; } 13Web Design Principles 5th Ed.
  • 16. Grouping Columns • The <colgroup> and <col> elements allow you to apply style characteristics to groups of columns or individual columns • The <colgroup> element has a span attribute that lets you set the number of columns specified in the group • The <col> element lets you specify style characteristics for individual columns 16Web Design Principles 5th Ed.
  • 19. Styling the Caption • You can position the caption on the top or bottom of the table using the caption-site property • You can also apply other style properties to enhance the caption text: caption {text-align: left; font-style: italic; padding-bottom: 10px; } 19Web Design Principles 5th Ed.
  • 22. Styling Table Borders • By default, table borders are turned off • You can add borders using CSS • Borders can be applied to the whole table, to individual rows, and to individual cells 22Web Design Principles 5th Ed.
  • 23. Styling Table Borders • To create a table with an outside border only: table { border: solid 1px black; border-collapse: collapse; } 23Web Design Principles 5th Ed.
  • 25. Styling Table Borders • To specify borders for each cell, use a separate style rule: table { border: solid 1px black; border-collapse: collapse; } th, td { border: solid 1px black; } 25Web Design Principles 5th Ed.
  • 27. Styling Table Borders • You can also style individual rows or cells and apply cell borders th { border-bottom: solid thick blue; background-color: #ccddee; } 27Web Design Principles 5th Ed.
  • 29. Applying Padding, Margins, and Floats to Tables
  • 30. Using Padding • You can enhance the legibility of your table data with padding • This style rule adds five pixels of padding to both types of table data elements th, td {padding: 5px;} 30Web Design Principles 5th Ed.
  • 32. Using Margins and Floats • Tables can be floated • Use margins to add white space around floating tables table.best { font-family: verdana; border: solid 1px black; border-collapse: collapse; float: left; margin-right: 20px; margin-bottom: 10px; } 32Web Design Principles 5th Ed.
  • 35. Styling Table Background Colors • You can apply background colors to: – Entire table – Single rows or cells – Column groups of individual columns • You can alternate colors for different rows • Add hover interactions 35Web Design Principles 5th Ed.
  • 37. Creating Alternate Color Rows • Table data is easier to read when alternate rows have a distinguishing background color • Write a style rule for the odd or even row using a class selector tr.odd td {background-color: #eaead5;} 37Web Design Principles 5th Ed.
  • 39. Creating Background Hover Effects • You can add interactivity to your table with hover effects • When the user hovers the pointer over a cell or row, the formatting can change td:hover { color: white; background-color: #722750; } 39Web Design Principles 5th Ed.
  • 41. Summary • Use tables for presentation of data, not for page layout • Use the grouping elements to apply styles to groups of rows or columns or to the header, body, and footer of a table • Apply borders to both the <table> and cell (<th> and <td>) elements to display a table border on the entire table • Use the border-collapse property to make table data more legible 41Web Design Principles 5th Ed.
  • 42. Summary • Always use CSS to add presentation style to tables • Use padding to add space within your cells to make your data more legible • You can float tables and add margins with the box model properties • Specify background colors or hovers to aid in the legibility of your data 42Web Design Principles 5th Ed.