Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the...

15
Tutorial 5: Tables Session 5.2.

Transcript of Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the...

Page 1: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Tutorial 5: Tables Session 5.2.

Page 2: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

OBJECTIVES

•Marking row groups•Marking column groups•Setting the table frame•Specifying the table’s internal gridlines•Formatting tables with CSS

Page 3: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Marking Row Groups

•You can divide a table’s rows into row groups, in which each group element contains different types of content and can be formatted differently

•You can use the following tags: <thead>, <tbody>, <tfoot>

•A table can have multiple table body row groups (several <tbody> tags).

Page 4: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Marking Row Groups<table> <thead> Table rows </thead><tbody> Table rows</tbody><tfoot> Table rows</tfoot></table>

Page 5: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Marking Column Groups

•Once the table columns have been determined by the browser, you can reference them through the use of column groups.

•Use the colgroup tag: <colgroup>

Page 6: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Practice – Row Groups and Column Groups1. In morning.htm, below the caption, create a

column group containing three columns. The first col element should have the class name timeColumn. The second col element should have the class name wDayColumns and span five columns in the table. The last col element should have the class name wEndColumns and spans two columns.

2. Add the table header row group containing the first row.

3. Enter the table body row group containing the times and names of the different KPAF programs.

Page 7: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Setting the Table Frame• A table frame specifies which sides of the table

(or which sides of the table cells) will have borders<table border="value" frame="type"> ... </table>

Page 8: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Setting the Table Frame

Page 9: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Specifying the Table’s Internal Gridlines•A table rule specifies how the internal

gridlines are drawn within the table<table border="value" rules="type"> ... </table>

Page 10: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Practice – Table frame and internal gridlines1. Specify the table frame as border.2. Indicate that the internal gridlines

should use the “all” value.

Page 11: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Formatting Tables with CSS

•Using the selector <table> or <tr> or <th> or <td>, you can format the table using the properties we learned in previous chapter including: font-family, font-size, font-style, border-width, border-color, etc.

Page 12: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Formatting Tables with CSS• To define the border model used by the table,

apply the table styleborder-collapse: typewhere type is separate (the default) to keep all borders around cells and the table itself apart, or collapse to merge all adjacent borders

• To set the space between separated borders, apply the table styleborder-spacing: valuewhere value is the space between the borders in any of the CSS units of measure

Page 13: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Formatting Tables with CSS

•Vertical alignment of the content within cell(s):▫vertical-align property▫Values: top, middle, bottom▫Example:

vertical-align: top;

Page 14: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Formatting Tables with CSS

•To position a table caption, apply the stylecaption-side: positionwhere position is top or bottom

Page 15: Tutorial 5: Tables Session 5.2.. OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.

Practice – Formatting Tables with CSS•Go to programs.css.•Create a style rule for the programs table to:

▫Set the width of the table to 100%.▫Add a 2-pixel solid black border that is collapsed

around the table.▫Set the font family to the following list of fonts:

Arial, Verdana, and sans-serif.•Create a style rule so that the table caption is

aligned with the bottom-left corner of the table. Set the caption font size to 0.8em.