Lesson Practice 6-2:
Styling Tables
Task 1 - Controlling Cell Widths and Heights
- Open a text2.htm in Notepad++. Immediately Save the file in
your CSS folder as box6.htm.
- In the title element, add the title: Controlling
Cell Widths and Heights
- Remove the width attribute from the table tag.
- Change the h2 header at the top of the page to
same text as in the title.
- To the table rule, add a declaration making the width of the table
60% of the available space on the page.
- Create a class named .cellw and add a declaration to set the width
to 33%.
- Create a class named .rowh and add as declaration to set the height
to 100 pixels.
- Add the cellw class to all cells in the first row.
- Add the rowh class each row in the table.
- Add a div element to enclose the entire table. Apply the center class
to the div element.
- Preview the file to see the effects. If any property does not work,
trouble-shoot to fix it.
- Save the file again.
Task 2 - Working with Vertical Alignment in Tables
- Open a box6.htm in Notepad++. Immediately Save the file in
your CSS folder as box7.htm.
- In the title element, add the title: Working with
Vertical Alignment in Tables
- Change the text in the h2 header at the top of the page to the same text as in
the title.
- Create a class named .top and set the vertical alignment to top.
- Create a class named .bottom and set the vertical alignment to bottom.
- Add the top class to the second, fifth and eighth rows (the ones
that say row 1, row 4, and row 7).
- Add the bottom class to the fourth and seventh rows (the ones that
say row 3 and row 6).
- Preview the file to see the effects. Notice that the rows you did
not change are centered vertically by default. If
any property does not work, trouble-shoot to fix it.
- Save the file again.
Task 3 - Working with Spacing in Tables
- Open a box7.htm in Notepad++. Immediately Save the file in your
CSS folder as box8.htm.
- In the title element, add the title: Working with
Spacing in Tables
- Change the text in the h2 header at the top of the page to the same
text as in the title.
- Create a class named .topspace and set the top padding to 20 pixels.
- Create a class named .bottomspace and set the bottom padding to 15
pixels.
- Create a class named .sidespace and set the left and right padding
to 10 pixels.
- Add the topspace class to each cell in the second row (the
ones that says row 1).
- Add the bottomspace class to each cell in the the seventh row (the
ones that says row 6).
- Add the sidespace class to the first and last cells in each row.
- Preview the file to see the effects. If any property does
not work, trouble-shoot to fix it.
- Save the file again.
Task 4 - Controlling Table Borders
- Open a box8.htm in Notepad++. Immediately Save the file in
your CSS folder as box9.htm.
- In the title element, add the title: Controlling
Table Borders
- Change the text in the h2 header to the top of the page to the same text as in
the title.
- In the table rule, remove the border spacing declaration and add the border-collapse property set to collapse.
- Preview the file to see the effects.
- Change/add declarations in the table rule to make the border
darkgray, 2 pixels and solid.
- Change/add declarations in the td rule to make the border darkgray,
1 pixel and solid
- Create a class named .bottomborder and set the bottom border to darkred,
2 pixels and double.
- Apply the bottomborder class to the cells in the top row (with col1,
col2, col3 in it).
- Preview the file to see the effects. If any property does not work,
trouble-shoot to fix it.
- Save the file again.
|