Professional Documents
Culture Documents
THE INTERNET
GOAL
This lecture covers tables, their use in Web pages, and their tags. It also covers table layout, structure, design, and nesting. Using tables to format Web pages is also covered.
Lecture 6 - Tables
INTRODUCTION
the conventional way (tabulate data), and the new way (to impose structure and format on Web pages)
Lecture 6 - Tables
Each cell holds its own content (data). Cell data could be any HTML element
Many HTML editors use tables for formatting when they are used to develop Web pages It is often difficult to follow HTML code of Web pages that are formatted via tables Tables may have horizontal, vertical, or both headings Table definition tags are either cell-based tags or non-cell based tags (more definitions on this later)
Lecture 6 - Tables
Each table has a generic structure (below) consisting of rows, columns, and cells
Lecture 6 - Tables
table caption, summary, border, header, rows, columns, width, height, cells, and Rules
6
Lecture 6 - Tables
Lecture 6 - Tables
Cell spacing is the room between cells in a table. Cell padding is the amount of "margin space" within the cells in a table.
Lecture 6 - Tables
Lecture 6 - Tables
10
Lecture 6 - Tables
11
Lecture 6 - Tables
TABLE TAGS
HTML provides tags to create tables and control their variables The table tags are <TABLE>, <CAPTION>, <TR>, <TH>, and <TD> The <TABLE> tag acts as the container tag for all the others
12
Lecture 6 - Tables
SUMMARY, WIDTH(in pixels or screen percentage), HEIGHT (in pixels or screen percentage), BORDER (in pixels), ALIGN (Left, Right, Center), CELLSPACING (in pixels), and CELLPADDING (in pixels)
13
Lecture 6 - Tables
14
Lecture 6 - Tables
Lecture 6 - Tables
defined
16
Lecture 6 - Tables
Table #1
17
Lecture 6 - Tables
Table #2
Lecture 6 - Tables
19
10
Table #3
21
Lecture 6 - Tables
11
Table #4
23
Lecture 6 - Tables
24
Lecture 6 - Tables
12
Table #5
25
Lecture 6 - Tables
13
Note the empty locations in the table since there weren't any cells defined for this location. Table #6
Lecture 6 - Tables
27
Lecture 6 - Tables
14
Table #7
29
Lecture 6 - Tables
Lecture 6 - Tables
Calculate table width and height Calculate the number of columns in a table Calculate the size of a table cell Calculate cell spacing and padding Determine inheritance of alignment specifications
30
15
31
Lecture 6 - Tables
NESTING TABLES
Web authors may nest tables to achieve certain design goals of their Web pages Table nesting makes HTML code quite complex and difficult to follow HTML nests tables at the cell level. Web authors can create an entire table inside a cell of another table. Nesting tables may produce awkward results
32
Lecture 6 - Tables
16
Table #8
34
Lecture 6 - Tables
17
35
Table #9
36
18
Lecture 6 - Tables
Formatting is achieved at the cell level. Web authors can create an entire Web page inside a table cell.
Each table cell can be viewed as an independent screen that can hold any HTML content including a full Web page
37
38
Lecture 6 - Tables
19
<TR VALIGN = "top"> <TD BGCOLOR = "yellow"> <IMG SRC = "myImage.gif"> </TD>
39
<TD BGCOLOR = "gray"> Here are some Web sites to visit <A HREF = "http://www.neu.edu">Check latest NU offerings<BR> <A HREF = "http://www.prenhall.com">Prentice Hall latest books<BR> <A HREF = "example16.1.html">Various types of tables </TD> <TD BGCOLOR = "purple"> It is once said that physical fitness and exercises are very important to maintain a healthy life. We all must eat well balanced meals, work out at least three times a week, 45 minutes each time. </TD> </TR> </TABLE>
40
20
41
Lecture 6 - Tables
FAQS
Q: Does the <CAPTION> tag replace the SUMMARY attribute of the <TABLE> tag?
A: No. The <CAPTION> tag provides a very brief, onestatement description of a table. The SUMMARY attribute of the <TABLE> tag provides much more information about the table structure and purpose, to help disabled Web surfers to understand the table.
42
Lecture 6 - Tables
21
FAQS
Q: What is a good way to debug HTML code while using tables to format Web pages?
A: Use the BORDER attribute of the <TABLE> tag to get an idea of how the browser is creating the table rows, columns, and cells that you have designed. These borders should help you immensely in deciding what to change to finalize the formatting. Once you like the final layout of the page, you can then simply remove the BORDER attribute.
43
Lecture 6 - Tables
SUMMARY
HTML tables can be used to tabulate data or to format Web pages A table consists of rows. Each row is divided into cells (columns) A table has non-cell (control table structure and layout) and cell variables (control cell layout) Non-cell variables are caption, summary, border, header, rows, width, height, cells, and rules
44
Lecture 6 - Tables
22
SUMMARY - CONTINUED
Cell variables are row span, column span, padding, spacing, and alignment Table tags are <TABLE>, <CAPTION>, <TH>, <TR>, and <TD> The attributes of the <TABLE> tag are SUMMARY, WIDTH, HEIGHT, BORDER, ALIGN, FRAME, CELLSPACING, and CELLPADDING The attributes of the <TH> and <TD> tags are ABBR, AXIS, HEADERS, SCOPE, ROWSPAN, COLSPAN, NOWRAP, WIDTH, HEIGHT, ALIGN, VALIGN, CELLPADDING, and BGCOLOR
45
Lecture 6 - Tables
23