actual building the pages tables. using table elements to build effective page templates, you must...

61
Actual Building Actual Building the Pages the Pages Tables Tables

Upload: dustin-white

Post on 12-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Actual Building the Actual Building the PagesPagesTablesTables

Page 2: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Using Table ElementsUsing Table Elements

To build effective page templates, you must be To build effective page templates, you must be familiar with the HTML table elements and familiar with the HTML table elements and attributes attributes

The <table> element contains the table The <table> element contains the table information, which consists of table row information, which consists of table row elements <tr>, and individual table data cells elements <tr>, and individual table data cells <td>. These are the three elements you will <td>. These are the three elements you will use most frequently when you are building use most frequently when you are building tables.tables.

Page 3: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 4: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Basic Table CodeBasic Table Code

<TABLE BORDER><TABLE BORDER><TR><TD>Stock <TR><TD>Stock Number</TD><TD>Description</TD><TD>List Number</TD><TD>Description</TD><TD>List Price</TD></TR>Price</TD></TR><TR><TD>3476-AB</TD><TD>76mm <TR><TD>3476-AB</TD><TD>76mm Socket</TD><TD>45.00</TD></TR>Socket</TD><TD>45.00</TD></TR><TR><TD>3478-AB</TD><TD>78mm <TR><TD>3478-AB</TD><TD>78mm Socket</TD><TD>47.50</TD></TR>Socket</TD><TD>47.50</TD></TR><TR><TD>3480-AB</TD><TD>80mm <TR><TD>3480-AB</TD><TD>80mm Socket</TD><TD>50.00</TD></TR>Socket</TD><TD>50.00</TD></TR></TABLE></TABLE>

Page 5: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 6: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Captions and Table HeaderCaptions and Table Header

<caption> lets you add a caption to the top or <caption> lets you add a caption to the top or bottom of the table. By default, captions bottom of the table. By default, captions display at the top of the table. You can use the display at the top of the table. You can use the align=“bottom” attribute to align the caption at align=“bottom” attribute to align the caption at the bottom of the table.the bottom of the table.

The <th> tag lets you create a table header The <th> tag lets you create a table header cell that presents the cell content as bold and cell that presents the cell content as bold and centeredcentered

Page 7: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 8: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Defining Table AttributesDefining Table Attributes

Table attributes let you further define a Table attributes let you further define a number of table characteristics. You can number of table characteristics. You can apply attributes at three levels of table apply attributes at three levels of table structure: global, row-level, or cell-level.structure: global, row-level, or cell-level.

Page 9: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 10: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 11: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 12: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Spanning ColumnsSpanning Columns

The COLSPAN attribute lets you create The COLSPAN attribute lets you create cells that span multiple columns of a table. cells that span multiple columns of a table. Column cells always span to the right.Column cells always span to the right.

Page 13: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 14: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Spanning RowsSpanning Rows

The ROWSPAN attribute lets you create The ROWSPAN attribute lets you create cells that span multiple rows of a table. cells that span multiple rows of a table. Rows always span down.Rows always span down.

Page 15: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 16: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Relative or Absolute WidthsRelative or Absolute Widths

Set relative table widths as percentages in Set relative table widths as percentages in the table width attribute. If you choose the table width attribute. If you choose relative table widths, your tables will resize relative table widths, your tables will resize based on the size of the browser window.based on the size of the browser window.

Set absolute table widths as pixel values in Set absolute table widths as pixel values in the table width attribute. Fixed tables the table width attribute. Fixed tables remain constant regardless of the browser remain constant regardless of the browser window size.window size.

Page 17: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 18: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 19: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Calculating Table WidthsCalculating Table Widths

The most common width for page template The most common width for page template tables is approximately 750 pixels. This tables is approximately 750 pixels. This width supports the 800 x 600 screen width supports the 800 x 600 screen resolution.resolution.

Page 20: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 21: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Default Table SpacingDefault Table Spacing

Default spacing values are included in the Default spacing values are included in the table even when you don’t specify values for table even when you don’t specify values for the table’s border, cellpadding, or cellspacing the table’s border, cellpadding, or cellspacing attributesattributes

Depending on the browser, approximately Depending on the browser, approximately two pixels are reserved for each of these two pixels are reserved for each of these valuesvalues

You can remove the default spacing by You can remove the default spacing by explicitly stating a zero value for each explicitly stating a zero value for each attributeattribute

Page 22: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 23: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 24: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 25: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 26: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 27: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Table PointersTable Pointers

Write easy-to-read code - You can simplify Write easy-to-read code - You can simplify your table creation and maintenance tasks by your table creation and maintenance tasks by writing clean, commented codewriting clean, commented code

Remove extra spaces - Always remove any Remove extra spaces - Always remove any leading or trailing spaces in your table cell leading or trailing spaces in your table cell contentcontent

Center tables - Centering a fixed table makes Center tables - Centering a fixed table makes the table independent of resolution changes, the table independent of resolution changes, because the table is always centered in the because the table is always centered in the browser windowbrowser window

Page 28: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Table PointersTable Pointers

Stack tables - Because of the way browsers Stack tables - Because of the way browsers display tables, it’s best to build several display tables, it’s best to build several smaller tables rather than one large onesmaller tables rather than one large one

Nest tables - You can nest tables by Nest tables - You can nest tables by placing an entire table within a table cellplacing an entire table within a table cell

Page 29: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 30: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 31: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 32: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Creating a Page TemplateCreating a Page Template

In this example you’ll see how to take a In this example you’ll see how to take a design sketch for a Web page and build a design sketch for a Web page and build a template for the page layouttemplate for the page layout

Figure 5-19 shows a sketch of the desired Figure 5-19 shows a sketch of the desired layout. This layout is designed for a base layout. This layout is designed for a base screen resolution of 800 x 600, so the table screen resolution of 800 x 600, so the table will be fixed at a width of 750 pixels.will be fixed at a width of 750 pixels.

Page 33: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Creating a Page TemplateCreating a Page Template

Notice that the basic structure of the table Notice that the basic structure of the table is 3 rows by 4 columns. Each column uses is 3 rows by 4 columns. Each column uses 25% of the total width of the template. Row 25% of the total width of the template. Row spans and column spans break across the spans and column spans break across the layout to provide visual interest.layout to provide visual interest.

Page 34: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 35: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Build the Basic StructureBuild the Basic Structure

Start by building the basic table structure, Start by building the basic table structure, including all the cells and rows of the tableincluding all the cells and rows of the table

As you customize the table you can remove As you customize the table you can remove extraneous cells as necessaryextraneous cells as necessary

The basic structure is a 3-row by 4-column The basic structure is a 3-row by 4-column table table

Page 36: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Setting a Fixed WidthSetting a Fixed Width

One of the design characteristics of the One of the design characteristics of the template is a fixed width that is not template is a fixed width that is not dependent on the user’s browser size or dependent on the user’s browser size or screen resolutionscreen resolution

To accomplish this, use a pixel value in the To accomplish this, use a pixel value in the global WIDTH attributeglobal WIDTH attribute

Page 37: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 38: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Creating the Page BannerCreating the Page Banner

The page banner cell is R1C1. This cell The page banner cell is R1C1. This cell spans the four columns of the table using spans the four columns of the table using the colspan attribute.the colspan attribute.

Page 39: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 40: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Creating the Feature CellCreating the Feature Cell

The Feature cell in the layout is R2C2, and The Feature cell in the layout is R2C2, and spans two columns. This column span spans two columns. This column span requires the removal of one cell in row two requires the removal of one cell in row two to make room for the span.to make room for the span.

Page 41: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 42: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Creating the Link ColumnsCreating the Link Columns

The New Link and Linked Ads columns in The New Link and Linked Ads columns in the layout reside in cells R2C1 and R2C3 the layout reside in cells R2C1 and R2C3 respectively. These cells span rows 2 and 3 respectively. These cells span rows 2 and 3 of the table. The row spans require the of the table. The row spans require the removal of cells R3C1 and R3C4.removal of cells R3C1 and R3C4.

Page 43: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 44: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 45: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Creating the Page BannerCreating the Page Banner

Column widths must be set in only one cell Column widths must be set in only one cell per columnper column

It’s also best to set the column widths in It’s also best to set the column widths in only one row of the tableonly one row of the table

Setting the column width ensures that the Setting the column width ensures that the text will wrap properlytext will wrap properly

Page 46: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 47: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Testing the TemplateTesting the Template

To verify that your template works properly, To verify that your template works properly, populate it with test contentpopulate it with test content

Test the template in multiple browsers Test the template in multiple browsers

Page 48: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 49: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 50: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 51: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 52: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 53: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Template ExamplesTemplate Examples

The following templates cover a variety of The following templates cover a variety of page layout needspage layout needs

You may choose to stack different You may choose to stack different templates on top of each other for more templates on top of each other for more complex layoutscomplex layouts

Page 54: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 55: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 56: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 57: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 58: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 59: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes
Page 60: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Tables SummaryTables Summary

Plan your tables by sketching them out first Plan your tables by sketching them out first Use fixed table widths if you want to Use fixed table widths if you want to

determine the size of your page rather than determine the size of your page rather than letting the browser determine the widthletting the browser determine the width

Use relative widths if you want to build Use relative widths if you want to build tables that resize with the browser window, tables that resize with the browser window, wrapping your content to fitwrapping your content to fit

Page 61: Actual Building the Pages Tables. Using Table Elements  To build effective page templates, you must be familiar with the HTML table elements and attributes

Tables Summary continuedTables Summary continued

Work on your pages with the table borders Work on your pages with the table borders turned on, which displays the cell boundaries. turned on, which displays the cell boundaries. When you are finished with your layout you When you are finished with your layout you can turn the borders off.can turn the borders off.

Size your tables based on the page size you Size your tables based on the page size you want to create. Use 800 x 600 as your base want to create. Use 800 x 600 as your base screen resolution. In most cases you’ll set the screen resolution. In most cases you’ll set the width but not the height of your tables, width but not the height of your tables, allowing the content to flow down the page.allowing the content to flow down the page.