How to work with tables Chapter 10.

Slides:



Advertisements
Similar presentations
INTRODUCTORY Tutorial 8 Creating Data Tables. XP Objectives Contrast data tables with layout tables Create a table to display and organize data Provide.
Advertisements

Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Designing Web Pages Tables part one. Using Tables for Page Layout 2.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 6: HTML Tables.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 Table1.html 1 2
Creating Tables Text Tables -created by using preformatted tags. Graphical Tables - created using Table Structure with HTML.
Web Development & Design Foundations with XHTML Chapter 8 Key Concepts.
Chapter 4 – Intermediate HTML 4 Outline 4.1 Unordered Lists 4.2 Nested and Ordered Lists 4.3 Basic HTML Tables 4.4 Intermediate HTML Tables and Formatting.
HTML. Creating a Table Attributes: border: indicates the border type of the table Value: 0 (no border), 1, 2, etc. cols: indicates the number of columns.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
Tutorial #8 – Creating Data Tables. Tutorial #6 Review – Layouts Two Column Fixed Width, Three Column Fixed Width Class VS. ID Container Universal Selector.
CIS 1310 – HTML & CSS 8 Tables. CIS 1310 – HTML & CSS Learning Outcomes  Create a Table  Apply Attributes to Format Tables  Increase the Accessibility.
XP 1 Tutorial 4 Designing a Web Page with Tables.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
INTRODUCTORY Tutorial 7 Creating Tables. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Discern the difference between data tables and.
Principles of Web Design 6 th Edition Chapter 10 – Data Tables.
Web Development & Design Foundations with XHTML Chapter 8 Key Concepts.
HTML B OOT C AMP Chapter 10 Tables Kirkwood Continuing Education © Copyright 2015, Fred McClurg All Rights Reserved.
Chapter 9 Table Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Tutorial 5 Working with Tables and Columns
Web Development & Design Foundations with XHTML Chapter 8 Key Concepts.
Tutorial 5 Working with Tables and Columns
Html Tables Basic Table Markup. How Tables are Used For Data Display Tables were originally designed to display and organize tabular data (charts, statistics,
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything › Text › Lists › Other tables › Pictures › …
 2003 Prentice Hall, Inc. All rights reserved. Introduction to HTML: Tables Outline 1 Introduction 2 Basic HTML Tables 3 Intermediate HTML Tables and.
Computer Science 101 Lists and Tables. Lists Unordered lists - use a bullet Ordered lists - use a number, Roman numeral, or letter.
CIS234A Lecture 8 Instructor Greg D’Andrea. Review Text Table contains only text, evenly spaced on the Web page in rows and columns uses only standard.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 8 Key Concepts 1 Copyright © Terry Felke-Morris.
HTML Tables The HTML table model allows authors to arrange data - text, preformatted text, images, links, forms, form fields, other tables, etc. - into.
Jozef Goetz, © Pearson Education Copyright (c) 2006 Prentice-Hall. All rights reserved.
Creating Tables in a Web Site HTML 4 Created by S. Cox.
Chapter 9 Table Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Copyright © 2012 Certification Partners, LLC -- All Rights Reserved Lesson 5: HTML Tables.
Tables creating a table within a web page. What makes up a table? Columns Rows.
Designing a Web Page with Tables
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Organizing Content with Lists and Tables
Web Development & Design Foundations with HTML5
Internet & Web Engineering Course Code:CS-228 Credit Hours (3+1) Lab 2 HTML TABLES Instructor: Muhammad Zeeshan Haider Ali Blog Address:
Yourfriendmanoj.wordpress.com Fb/yourfriendmanoj
Working with Tables: Module A: Table Basics
>> HTML: Tables.
Web Development & Design Foundations with HTML5 8th Edition
LAB Work 02 MBA 61062: E-Commerce
HTML Tables CS 1150 Spring 2017.
HTML Tables.
Tutorial 5 Working with Tables and Columns
Chapter 7 Tables.
The Internet 10/25/11 XHTML Tables
Session I Chapter 10 - How to Work with Tables
8 Tables.
HTML and CSS 8th Edition Chapter 18: Tables.
Lesson 8 Building Tables.
HTML Level II (CyberAdvantage)
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with H T M L 5
Implementing Tables to Hold Data in HTML
Web Development & Design Foundations with HTML5
Murach's HTML and CSS, 4th Edition
Site Development Foundations Lesson 6
ITI 134: HTML5 Desktop and Mobile Level II
Principles of Web Design 5th Edition
Lesson 5: HTML Tables.
Web Development & Design Foundations with HTML5
Basics of Web Design Chapter 9 Table Basics Key Concepts
Presentation transcript:

How to work with tables Chapter 10

Learning Outcomes Applied Use HTML to create tables with merged cells, captions, headers, and footers. Use CSS and the CSS3 structural pseudo-classes to format the tables that you create. Use the HTML5 figure and figcaption elements to treat a table as a figure. Use HTML to provide accessibility for tables. Knowledge Describe these components of a table: rows, columns, cells, header cells, data cells, table header, table footer, and table body. Describe the proper use of tables, now that CSS should be used for page layout. Describe the use of nesting and wrapping with tables. Describe the use of the table attributes for accessibility. 

HTML Tables 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

HTML Elements for Coding Tables <table> Contains the table, (block display) <tr> Contains a table row <td> Contains a table data cell <th> Contains a table header cell <caption> Configures a description of the table, (block display); must be inserted immediately after the <table> tag.

<table> <tr> <th>Book</th> <th>Year Published</th> <th>Sales</th> </tr> <td>PHP and MySQL</td> <td>2014</td> <td>$372,381</td> . <th>Total Sales</th> <td></td> <td>$2,154,786</td> </table> HTML Table Example

HTML colspan Attribute <table> <tr> <td colspan="2">Birthday List</td> </tr> <td>James</td> <td>11/08</td> <td>Karen</td> <td>4/17</td> </table>

HTML rowspan Attribute <table> <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>

Grouping Table Content <thead> Groups the header content in a table <tbody> Groups the body content in a table <tfoot> Groups the footer content in a table

Table Row Groups Example <caption>Work Schedule</caption> <thead> <tr> <th>Day</th> <th>Hours</th> </tr> </thead> <tbody> <td>Monday</td> <td>4</td> <td>Tuesday</td> <td>3</td> </tbody> <tfoot> <td>Total</td> <td>7</td> </tfoot> </table> Table Row Groups Example

Enclosing Tables in Figures You can enclose a table in figure element and use the figcaption element in place of the table caption element <figure> <figcaption>Total Sales by Book</figcaption> <table> . </table> </figure>

Accessibility and Tables Use the caption element to provide the title/caption for the table OR enclose the table in figure element and use figcaption to provide the title/caption for the table. Use table header elements (<th> tags) to indicate column or row headings. Other attributes that provide for accessibility: headers & id scope

Table accessibility: headers, scope and id scope attribute Used on th elements; specifies whether a header cell is a header for a column, row, or group of columns or rows; typical values "col" or "row" id attribute Used on th elements to identify the element headers attribute Used on td elements; specifies a space-separated list of id's (from the th's) to one or more header cells the header cell is related to

The HTML for a table that provides for accessibility <caption>Total sales for books published from 2008 to 2012</caption> <thead> <tr> <th id="hdr_book" scope="col">Book</th> <th id="hdr_year" scope="col">Year Published</th> <th id="hdr_sales" scope="col">Sales</th> </tr> </thead> <tbody> <td headers="hdr_book">PHP and MySQL</td> <td headers="hdr_year">2014</td> <td headers="hdr_sales">$372,381</td>

The HTML for a table that provides for accessibility (cont.) <tr> <td headers="hdr_book">JavaScript and jQuery</td> <td headers="hdr_year">2015</td> <td headers="hdr_sales">$305,447</td> </tr> </tbody> <tfoot> <th id="hdr_total" scope="row">Total Sales</th> <td></td> <td headers="hdr_sales hdr_total">$2,154,786</td> </tfoot> </table>

Using CSS to Style a Table CSS Property Align a table: table { width: 75%; margin: auto; } Align within a table cell: text-align background-color padding border-spacing or border-collapse height vertical-align width border, border-style, or border-spacing background-image caption--side

CSS border-collapse property The border-collapse property sets whether the table borders are collapsed into a single border or detached as in standard HTML. Values: separate, collapse Default Value: separate Recommended declaration: table{border-collapse:collapse;} separated borders collapsed borders

CSS3 Structural Pseudo-classes 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

CSS that uses Pseudo-classes th:first-child, td:first-child {text-align: left; } th:nth-child(2), td:nth-child(2) {text-align: center; } tbody tr:nth-child(even) {background-color: silver; }