SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Copyright © Terry Felke-Morris
WEB DEVELOPMENT & DESIGN
FOUNDATIONS WITH HTML5
Chapter 8
Key Concepts
1Copyright © Terry Felke-Morris
Copyright © Terry Felke-Morris
LEARNING OUTCOMES
 In this chapter, you will learn how to ...
 Create a table on a web page
 Apply attributes to format tables, table rows, and table cells
 Increase the accessibility of a table
 Style an HTML table with CSS
2
Copyright © Terry Felke-Morris
HTML TABLE
 Tables are used on web pages
to organize tabular information
 Composed of rows and columns – similar to a
spreadsheet.
 Each individual table cell is at the intersection of a
specific row and column.
 Configured with table, tr, and td elements
3
Copyright © Terry Felke-Morris
HTML TABLE ELEMENTS
<table>
Contains the table
<tr>
Contains a table row
<td>
Contains a table cell
<caption>
Configures a description of the table
4
Copyright © Terry Felke-Morris
HTML
TABLE EXAMPLE
<table border="1">
<caption>Bird Sightings</caption>
<tr>
<td>Name</td>
<td>Date</td>
</tr>
<tr>
<td>Bobolink</td>
<td>5/25/10</td>
</tr>
<tr>
<td>Upland Sandpiper</td>
<td>6/03/10</td>
</tr>
</table>
5
Copyright © Terry Felke-Morris
HTML
TABLE EXAMPLE 2
<table border="1">
<tr>
<th>Name</th>
<th>Birthday</th>
</tr>
<tr>
<td>James</td>
<td>11/08</td>
</tr>
<tr>
<td>Karen</td>
<td>4/17</td>
</tr>
<tr>
<td>Sparky</td>
<td>11/28</td>
</tr>
</table>
6
Using the <th> Element
Copyright © Terry Felke-Morris
HTML COMMON TABLE ATTRIBUTES
 align (obsolete)
 bgcolor (obsolete)
 border (obsolete)
 cellpadding (obsolete)
 cellspacing (obsolete)
 summary (obsolete but may be reinstated)
 width (obsolete)
 Use CSS to configure table characteristics
instead of HTML attributes
7
Copyright © Terry Felke-Morris
HTML COMMON TABLE CELL ATTRIBUTES
 align (obsolete)
 bgcolor (obsolete)
 colspan
 rowspan
 valign
 height (deprecated)
 width (deprecated)
 Use CSS to configure most table cell characteristics
instead of HTML attributes
8
Copyright © Terry Felke-Morris
HTML COLSPAN ATTRIBUTE
<table border="1">
<tr>
<td colspan=“2”>
Birthday List</td>
</tr>
<tr>
<td>James</td>
<td>11/08</td>
</tr>
<tr>
<td>Karen</td>
<td>4/17</td>
</tr>
</table>
9
Copyright © Terry Felke-Morris
HTML ROWSPAN ATTRIBUTE
<table border="1">
<tr>
<td rowspan="2">This spans two rows</td>
<td>Row 1 Column 2</td>
</tr>
<tr>
<td>Row 2 Column 2</td>
</tr>
</table>
10
Copyright © Terry Felke-Morris
ACCESSIBILITY AND TABLES
 Use table header elements (<th> tags) to indicate column or row
headings.
 Use the caption element to provide a text title or caption for the
table.
 Complex tables:
Associate table cell values with their corresponding headers
◦ <th> tag id attribute
◦ <td> tag headers attribute
11
Copyright © Terry Felke-Morris
<table border="1">
<caption>Bird Sightings</caption>
<tr>
<th id="name">Name</th>
<th id="date">Date</th>
</tr>
<tr>
<td headers="name">Bobolink</td>
<td headers="date">5/25/10</td>
</tr>
<tr>
<td headers="name">Upland Sandpiper</td>
<td headers="date">6/03/10</td>
</tr>
</table>
12
Copyright © Terry Felke-Morris
CHECKPOINT
1. Describe the purpose of using a table on a web page.
2. Describe the difference between the cellpadding and
cellspacing table attributes.
3. Describe one coding technique that increases the
accessibility of an HTML table.
13
Copyright © Terry Felke-Morris
USING CSS TO STYLE A TABLE
HTML
Attribute
CSS Property
align Align a table: table { width: 75%;
margin: auto; }
Align within a table cell: text-align
bgcolor background-color
cellpadding padding
cellspacing border-spacing or border-collapse
height height
valign vertical-align
width width
border border, border-style, or border-spacing
-- background-image
14
Copyright © Terry Felke-Morris
CSS STRUCTURAL PSEUDO-CLASSES
Pseudo-class Purpose
:first-of-type Applies to the first element of the specified type
:first-child Applies to the first child of an element (CSS2
selector)
:last-of-type Applies to the last element of the specified type
:last-child Applies to the last child of an element
:nth-of-type(n) Applies to the “nth” element of the specified type
Values: a number, odd, or even
15
Zebra Stripe a Table
tr:nth-of-type(even) { background-color: #eaeaea; }
Copyright © Terry Felke-Morris
TABLE ROW
GROUPS
<table> <caption>Time Sheet</caption>
<thead>
<tr>
<th id="day">Day</th>
<th id="hours">Hours</th>
</tr>
</thead>
<tbody>
<tr>
<td headers="day">Monday</td>
<td headers="hours">4</td>
</tr>
…
<tr>
<td headers="day">Friday</td>
<td headers="hours">3</td>
</tr>
</tbody>
<tfoot>
<tr>
<td headers="day">Total</td>
<td headers="hours">18</td>
</tr>
</tfoot> </table>
 <thead>
table head rows
 <tbody >
table body rows
 <tfoot>
table footer rows
16
Copyright © Terry Felke-Morris
SUMMARY
 This chapter introduced the HTML and CSS
techniques used to create and configure
tables on web pages.
17

Weitere ähnliche Inhalte

Was ist angesagt?

HTML frames and HTML forms
HTML frames and HTML formsHTML frames and HTML forms
HTML frames and HTML formsNadine Cruz
 
3. tutorial html web desain
3. tutorial html web desain3. tutorial html web desain
3. tutorial html web desainfaizibra
 
html for beginners
html for beginnershtml for beginners
html for beginnersKIIZAPHILIP
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)club23
 
The complete-html-cheat-sheet
The complete-html-cheat-sheetThe complete-html-cheat-sheet
The complete-html-cheat-sheetHARUN PEHLIVAN
 
HTML Walkthrough Internship Course
HTML Walkthrough Internship CourseHTML Walkthrough Internship Course
HTML Walkthrough Internship CourseZoltan Iszlai
 
HTML (Hyper Text Markup Language) by Mukesh
HTML (Hyper Text Markup Language) by MukeshHTML (Hyper Text Markup Language) by Mukesh
HTML (Hyper Text Markup Language) by MukeshMukesh Kumar
 
Getting Information through HTML Forms
Getting Information through HTML FormsGetting Information through HTML Forms
Getting Information through HTML FormsMike Crabb
 

Was ist angesagt? (20)

HTML Email
HTML EmailHTML Email
HTML Email
 
HTML
HTMLHTML
HTML
 
HTML
HTMLHTML
HTML
 
HTML frames and HTML forms
HTML frames and HTML formsHTML frames and HTML forms
HTML frames and HTML forms
 
Html tags or elements
Html tags or elementsHtml tags or elements
Html tags or elements
 
Html tags describe in bangla
Html tags describe in banglaHtml tags describe in bangla
Html tags describe in bangla
 
3. tutorial html web desain
3. tutorial html web desain3. tutorial html web desain
3. tutorial html web desain
 
HTML5 Web Forms
HTML5 Web FormsHTML5 Web Forms
HTML5 Web Forms
 
Html tag list
Html tag listHtml tag list
Html tag list
 
html for beginners
html for beginnershtml for beginners
html for beginners
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
Week 2
Week 2Week 2
Week 2
 
Html 5 tags
Html  5 tagsHtml  5 tags
Html 5 tags
 
The complete-html-cheat-sheet
The complete-html-cheat-sheetThe complete-html-cheat-sheet
The complete-html-cheat-sheet
 
HTML Walkthrough Internship Course
HTML Walkthrough Internship CourseHTML Walkthrough Internship Course
HTML Walkthrough Internship Course
 
Html 1
Html 1Html 1
Html 1
 
Html forms
Html formsHtml forms
Html forms
 
HTML (Hyper Text Markup Language) by Mukesh
HTML (Hyper Text Markup Language) by MukeshHTML (Hyper Text Markup Language) by Mukesh
HTML (Hyper Text Markup Language) by Mukesh
 
Advanced html
Advanced htmlAdvanced html
Advanced html
 
Getting Information through HTML Forms
Getting Information through HTML FormsGetting Information through HTML Forms
Getting Information through HTML Forms
 

Ähnlich wie Chapter 8 - Web Design

Ähnlich wie Chapter 8 - Web Design (20)

Chapter8
Chapter8Chapter8
Chapter8
 
Html Table
Html TableHtml Table
Html Table
 
RDBMS oracle function RDBMSRDBMSRDBMS.pptx
RDBMS oracle function RDBMSRDBMSRDBMS.pptxRDBMS oracle function RDBMSRDBMSRDBMS.pptx
RDBMS oracle function RDBMSRDBMSRDBMS.pptx
 
Working With Tables in HTML
Working With Tables in HTMLWorking With Tables in HTML
Working With Tables in HTML
 
01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx
 
CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
 
HTML Tables
HTML TablesHTML Tables
HTML Tables
 
Web I - 03 - Tables
Web I - 03 - TablesWeb I - 03 - Tables
Web I - 03 - Tables
 
Web forms and html lecture Number 3
Web forms and html lecture Number 3Web forms and html lecture Number 3
Web forms and html lecture Number 3
 
Html tables
Html tablesHtml tables
Html tables
 
tableslist.pptx
tableslist.pptxtableslist.pptx
tableslist.pptx
 
Html tables
Html tablesHtml tables
Html tables
 
Lecture4 web design and development
Lecture4 web design and developmentLecture4 web design and development
Lecture4 web design and development
 
Practicals it
Practicals itPracticals it
Practicals it
 
HTML Tables.ppt
HTML Tables.pptHTML Tables.ppt
HTML Tables.ppt
 
Html_Day_Three(W3Schools)
Html_Day_Three(W3Schools)Html_Day_Three(W3Schools)
Html_Day_Three(W3Schools)
 
WEP4 and 5.pptx
WEP4 and 5.pptxWEP4 and 5.pptx
WEP4 and 5.pptx
 
Html
HtmlHtml
Html
 
Html tables
Html tablesHtml tables
Html tables
 
HTML 5 Tables and Forms
HTML 5 Tables and FormsHTML 5 Tables and Forms
HTML 5 Tables and Forms
 

Mehr von tclanton4

Chapter 14 - Web Design
Chapter 14 - Web DesignChapter 14 - Web Design
Chapter 14 - Web Designtclanton4
 
Chapter 13 - Web Design
Chapter 13 - Web DesignChapter 13 - Web Design
Chapter 13 - Web Designtclanton4
 
Chapter 12 - Web Design
Chapter 12 - Web DesignChapter 12 - Web Design
Chapter 12 - Web Designtclanton4
 
Chapter 11 - Web Design
Chapter 11 - Web DesignChapter 11 - Web Design
Chapter 11 - Web Designtclanton4
 
Chapter 10 - Web Design
Chapter 10 - Web DesignChapter 10 - Web Design
Chapter 10 - Web Designtclanton4
 
Chapter 7 - Web Design
Chapter 7 - Web DesignChapter 7 - Web Design
Chapter 7 - Web Designtclanton4
 
Chapter 6 - Web Design
Chapter 6 - Web DesignChapter 6 - Web Design
Chapter 6 - Web Designtclanton4
 
Chapter 5 - Web Design
Chapter 5 - Web DesignChapter 5 - Web Design
Chapter 5 - Web Designtclanton4
 
Chapter 4 - Web Design
Chapter 4 - Web DesignChapter 4 - Web Design
Chapter 4 - Web Designtclanton4
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Designtclanton4
 
Chapter 1 - Web Design
Chapter 1 - Web DesignChapter 1 - Web Design
Chapter 1 - Web Designtclanton4
 
Charts in Calc
Charts in CalcCharts in Calc
Charts in Calctclanton4
 
Formatting a Worksheet in Calc
Formatting a Worksheet in CalcFormatting a Worksheet in Calc
Formatting a Worksheet in Calctclanton4
 
Creating a Worksheet in Calc
Creating a Worksheet in CalcCreating a Worksheet in Calc
Creating a Worksheet in Calctclanton4
 
Advanced Features of Writer
Advanced Features of WriterAdvanced Features of Writer
Advanced Features of Writertclanton4
 
Creating a Writer Document
Creating a Writer DocumentCreating a Writer Document
Creating a Writer Documenttclanton4
 

Mehr von tclanton4 (20)

Chapter 14 - Web Design
Chapter 14 - Web DesignChapter 14 - Web Design
Chapter 14 - Web Design
 
Chapter 13 - Web Design
Chapter 13 - Web DesignChapter 13 - Web Design
Chapter 13 - Web Design
 
Chapter 12 - Web Design
Chapter 12 - Web DesignChapter 12 - Web Design
Chapter 12 - Web Design
 
Chapter 11 - Web Design
Chapter 11 - Web DesignChapter 11 - Web Design
Chapter 11 - Web Design
 
Chapter 10 - Web Design
Chapter 10 - Web DesignChapter 10 - Web Design
Chapter 10 - Web Design
 
Chapter 7 - Web Design
Chapter 7 - Web DesignChapter 7 - Web Design
Chapter 7 - Web Design
 
Chapter 6 - Web Design
Chapter 6 - Web DesignChapter 6 - Web Design
Chapter 6 - Web Design
 
Chapter 5 - Web Design
Chapter 5 - Web DesignChapter 5 - Web Design
Chapter 5 - Web Design
 
Chapter 4 - Web Design
Chapter 4 - Web DesignChapter 4 - Web Design
Chapter 4 - Web Design
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Design
 
Chapter 1 - Web Design
Chapter 1 - Web DesignChapter 1 - Web Design
Chapter 1 - Web Design
 
Base2
Base2Base2
Base2
 
Base1
Base1Base1
Base1
 
Impress
ImpressImpress
Impress
 
Project Mgt
Project MgtProject Mgt
Project Mgt
 
Charts in Calc
Charts in CalcCharts in Calc
Charts in Calc
 
Formatting a Worksheet in Calc
Formatting a Worksheet in CalcFormatting a Worksheet in Calc
Formatting a Worksheet in Calc
 
Creating a Worksheet in Calc
Creating a Worksheet in CalcCreating a Worksheet in Calc
Creating a Worksheet in Calc
 
Advanced Features of Writer
Advanced Features of WriterAdvanced Features of Writer
Advanced Features of Writer
 
Creating a Writer Document
Creating a Writer DocumentCreating a Writer Document
Creating a Writer Document
 

Kürzlich hochgeladen

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
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.christianmathematics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
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.pdfQucHHunhnh
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
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.pdfAdmir Softic
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 

Kürzlich hochgeladen (20)

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
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.
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
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
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 

Chapter 8 - Web Design

  • 1. Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 8 Key Concepts 1Copyright © Terry Felke-Morris
  • 2. Copyright © Terry Felke-Morris LEARNING OUTCOMES  In this chapter, you will learn how to ...  Create a table on a web page  Apply attributes to format tables, table rows, and table cells  Increase the accessibility of a table  Style an HTML table with CSS 2
  • 3. Copyright © Terry Felke-Morris HTML TABLE  Tables are used on web pages to organize tabular information  Composed of rows and columns – similar to a spreadsheet.  Each individual table cell is at the intersection of a specific row and column.  Configured with table, tr, and td elements 3
  • 4. Copyright © Terry Felke-Morris HTML TABLE ELEMENTS <table> Contains the table <tr> Contains a table row <td> Contains a table cell <caption> Configures a description of the table 4
  • 5. Copyright © Terry Felke-Morris HTML TABLE EXAMPLE <table border="1"> <caption>Bird Sightings</caption> <tr> <td>Name</td> <td>Date</td> </tr> <tr> <td>Bobolink</td> <td>5/25/10</td> </tr> <tr> <td>Upland Sandpiper</td> <td>6/03/10</td> </tr> </table> 5
  • 6. Copyright © Terry Felke-Morris HTML TABLE EXAMPLE 2 <table border="1"> <tr> <th>Name</th> <th>Birthday</th> </tr> <tr> <td>James</td> <td>11/08</td> </tr> <tr> <td>Karen</td> <td>4/17</td> </tr> <tr> <td>Sparky</td> <td>11/28</td> </tr> </table> 6 Using the <th> Element
  • 7. Copyright © Terry Felke-Morris HTML COMMON TABLE ATTRIBUTES  align (obsolete)  bgcolor (obsolete)  border (obsolete)  cellpadding (obsolete)  cellspacing (obsolete)  summary (obsolete but may be reinstated)  width (obsolete)  Use CSS to configure table characteristics instead of HTML attributes 7
  • 8. Copyright © Terry Felke-Morris HTML COMMON TABLE CELL ATTRIBUTES  align (obsolete)  bgcolor (obsolete)  colspan  rowspan  valign  height (deprecated)  width (deprecated)  Use CSS to configure most table cell characteristics instead of HTML attributes 8
  • 9. Copyright © Terry Felke-Morris HTML COLSPAN ATTRIBUTE <table border="1"> <tr> <td colspan=“2”> Birthday List</td> </tr> <tr> <td>James</td> <td>11/08</td> </tr> <tr> <td>Karen</td> <td>4/17</td> </tr> </table> 9
  • 10. Copyright © Terry Felke-Morris HTML ROWSPAN ATTRIBUTE <table border="1"> <tr> <td rowspan="2">This spans two rows</td> <td>Row 1 Column 2</td> </tr> <tr> <td>Row 2 Column 2</td> </tr> </table> 10
  • 11. Copyright © Terry Felke-Morris ACCESSIBILITY AND TABLES  Use table header elements (<th> tags) to indicate column or row headings.  Use the caption element to provide a text title or caption for the table.  Complex tables: Associate table cell values with their corresponding headers ◦ <th> tag id attribute ◦ <td> tag headers attribute 11
  • 12. Copyright © Terry Felke-Morris <table border="1"> <caption>Bird Sightings</caption> <tr> <th id="name">Name</th> <th id="date">Date</th> </tr> <tr> <td headers="name">Bobolink</td> <td headers="date">5/25/10</td> </tr> <tr> <td headers="name">Upland Sandpiper</td> <td headers="date">6/03/10</td> </tr> </table> 12
  • 13. Copyright © Terry Felke-Morris CHECKPOINT 1. Describe the purpose of using a table on a web page. 2. Describe the difference between the cellpadding and cellspacing table attributes. 3. Describe one coding technique that increases the accessibility of an HTML table. 13
  • 14. Copyright © Terry Felke-Morris USING CSS TO STYLE A TABLE HTML Attribute CSS Property align Align a table: table { width: 75%; margin: auto; } Align within a table cell: text-align bgcolor background-color cellpadding padding cellspacing border-spacing or border-collapse height height valign vertical-align width width border border, border-style, or border-spacing -- background-image 14
  • 15. Copyright © Terry Felke-Morris CSS STRUCTURAL PSEUDO-CLASSES Pseudo-class Purpose :first-of-type Applies to the first element of the specified type :first-child Applies to the first child of an element (CSS2 selector) :last-of-type Applies to the last element of the specified type :last-child Applies to the last child of an element :nth-of-type(n) Applies to the “nth” element of the specified type Values: a number, odd, or even 15 Zebra Stripe a Table tr:nth-of-type(even) { background-color: #eaeaea; }
  • 16. Copyright © Terry Felke-Morris TABLE ROW GROUPS <table> <caption>Time Sheet</caption> <thead> <tr> <th id="day">Day</th> <th id="hours">Hours</th> </tr> </thead> <tbody> <tr> <td headers="day">Monday</td> <td headers="hours">4</td> </tr> … <tr> <td headers="day">Friday</td> <td headers="hours">3</td> </tr> </tbody> <tfoot> <tr> <td headers="day">Total</td> <td headers="hours">18</td> </tr> </tfoot> </table>  <thead> table head rows  <tbody > table body rows  <tfoot> table footer rows 16
  • 17. Copyright © Terry Felke-Morris SUMMARY  This chapter introduced the HTML and CSS techniques used to create and configure tables on web pages. 17