1 / 22

Web Development & Design Foundations with XHTML

Web Development & Design Foundations with XHTML. Chapter 8 Key Concepts. 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 Format the layout of a Web page with a table Use nested tables

zephr-chan
Download Presentation

Web Development & Design Foundations with XHTML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Development & Design Foundations with XHTML Chapter 8Key Concepts

  2. 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 • Format the layout of a Web page with a table • Use nested tables • Use CSS to configure an XHTML table

  3. Table • Tables are commonly used on Web pages in two ways: • To organize information • To format the layout of an entire Web page

  4. XHTMLUsing Tables • 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

  5. XHTMLTable Elements • <table> Element Contains the tableCommon attributes: border, width, align • <tr> ElementContains a table row • <td> ElementContains a table cell • <caption> Element • Configures a description of the table

  6. XHTMLTable Example <table border="1"><caption>Birthday List</caption> <tr> <td>Name</td> <td>Birthday</td> </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> Birthday List

  7. XHTMLTable 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> Using the <th> Element

  8. XHTMLCommon Table Attributes • align (deprecated) • bgcolor (deprecated) • border • cellpadding • cellspacing • summary • width • Percentage or pixels?

  9. XHTMLCommon Table Cell Attributes • align • bgcolor (deprecated) • colspan • rowspan • valign • height (deprecated) • width (deprecated)

  10. XHTMLcolspan 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>

  11. XHTMLrowspan Attribute <table border="1"> <tr> <td rowspan=“2> <img src=“cake.gif” alt=“cake” height=“100” width=“100” /></td> <td>James</td> </tr> <tr> <td>11/08</td> </tr> </table>

  12. Accessibility and Tables • Use <th> elements to indicate column or row headings. • Table element summary attribute • provide an overview of the table contents • Complex tables:Associate table cell values with their corresponding headers • <th> tag id attribute • <td> tag headers attribute

  13. <table border="1" width="75%" summary="This table lists my educational background. Each row describes educational experience at a specific school."> <tr> <th id="school">School Attended</th> <th id="years">Years</th> <th id="subject">Subject</th> <th id="degree" >Degree Awarded</th> </tr> <tr> <td headers="school">Schaumburg High School</td> <td headers="years">2000 - 2005</td> <td headers="subject">College Prep</td> <td headers="degree">H.S. Diploma</td> </tr> </table>

  14. <table border="1" width="75%" summary="This table lists my educational background."> <thead> <tr> <th>School Attended</th> <th>Years</th> </tr> </thead> <tbody> <tr> <td>Schaumburg High School</td> <td>2005 - 2009</td> </tr> <tr> <td>Harper College</td> <td>2009 - 2010</td> </tr> </tbody> </table> Table Row Groups • <thead>table head rows • <tbody >table body rows • <tfoot> table footer rows

  15. Checkpoint 8.1 1. Describe two reasons to use tables 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 XHTML table.

  16. XHTML– Using a Table toFormat a Web Page <table border="0" width="80%"> <tr> <td colspan="3"> <h1>This is the banner area</h1></td> </tr> <tr> <td width="20%" valign="top"> Place Navigation here</td> <td width="10">&nbsp;</td> <td>Page content goes here</td> </tr> </table>

  17. Additional Table Layouts

  18. Flexible & Fixed Table Widths • Fixed Table: • Table width attribute in pixels • http://www.redbox.com • http://www.yankeecandle.com • http://www.league.org • Flexible Table: • Table width attribute in percenthttp://www.co.door.wi.gov

  19. Nested Tables • Outer table configures page layout • Inner table organizessome information on the page

  20. Checkpoint 8.3 1. Describe a reason to use a percentage width for a table that configures a web page layout. Provide an example of a page that uses this technique. 2. Describe a reason to use a fixed pixel width for a table that configures a web page layout. Provide an example of a page that uses this technique. 3. True or False. Tables can be nested within other tables.

  21. Using CSS to Style a Table

  22. Summary • This chapter introduced the XHTML techniques used to create and configure tables. • You will use these skills over and over again as you create Web pages.

More Related