26 html tables … surround table … surround each row … surround each cell … like, but bold...

11
1 HTML Tables <table> </table> surround table <tr> </tr> surround each row <td> </td> surround each cell <th> </th> like <td>, but bold and centered by default (for table headings) <caption> … </caption> table title No tag to define a column. Number of columns determined by number of <td></td> pairs in a given row.

Upload: marilynn-knight

Post on 29-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

1

HTML Tables

• <table> … </table> surround table • <tr> … </tr> surround each row• <td> … </td> surround each cell• <th> … </th> like <td>, but bold and

centered by default (for table headings)• <caption> … </caption> table title

No tag to define a column. Number of columns determined by number of <td></td> pairs in a given row.

Page 2: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

2

Tables and CSS

• Use CSS to format tables

• background-color, color, font-family, padding, margin, border, text-align … all work with tables and cells

• border-collapse: collapse;

without with

Page 3: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

3

Spanning Rows and Columns

• Can create “irregular” tables • colspan attribute of td: # columns a cell spans

<tr> <td colspan=2>A</td></tr>

<tr> <td>B</td> <td>C</td></tr>

Page 4: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

4

Spanning Rows and Columns

• rowspan attribute of td: # rows a cell spans

<tr> <td>A</td> <td rowspan=2>B</td></tr>

<tr> <td>C</td></tr>

4

Page 5: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Spanning Rows and Columns

5

Page 6: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Planning the Table

Anniversary Gift

1st Paper

8th

9th

Pottery

Happy…6

Page 7: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Using tables for layout

-------- message --------

7

Page 8: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Using tables for layout

8

Page 9: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Exercise

Page 10: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Exercise

2 pixel red

border5 pixels btwn text & border

Page 11: 26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No

Exercise