introduction to web site development steven emory department of computer science california state...

28
Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

Post on 19-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

Introduction to Web Site Development

Steven EmoryDepartment of Computer Science

California State University, Los Angeles

Lecture 4:Tables and Frames

Page 2: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TABLE Element (Basics)

Description: Use the TABLE element to place data in a multidimensional structure, in the form of a table

Placement: Flow Content (i.e. don’t put a table inside a paragraph or in-between text)

Content: CAPTION, COLGROUP, THEAD, TFOOT, and TBODY elements

Page 3: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TABLE Element (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: REQUIRED

Self-Closing Tag: FORBIDDEN

Example

<TABLE> <TR><TD>1</TD><TD>2</TD></TR> <TR><TD>3</TD><TD>2</TD></TR> </TABLE>

Page 4: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TABLE Element (Attributes)

Optional Attributes

TITLE: Specify a tool tip when the mouse hovers over the table

Page 5: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The CAPTION Element (Basics)

Description: Use the CAPTION element to define caption text for the table (optional)

Placement: CAPTION must be a child of TABLE

Content: Flow content (excluding nested tables).

Page 6: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The CAPTION Element (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: REQUIRED

Self-Closing Tag: FORBIDDEN

Example

<TABLE><CAPTION>My Table Data</CAPTION><TR><TD>1</TD></TR> <TR><TD>2</TD></TR> </TABLE>

Page 7: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The CAPTION Element (Attributes)

Optional Attributes

TITLE: Specify a tool tip when the mouse hovers over the caption

Page 8: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TR Element (Basics)

Description: Use the TR element to begin a new row in a table

Placement: TR must be a child of TABLE, THEAD, TFOOT, or TBODY

Content: When parent is THEAD, zero or more TH elements; otherwise, zero or more TD or TH elements.

Page 9: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TR Element (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: OPTIONAL

Self-Closing Tag: YES (XML Syntax)

Example

<TABLE><TR><TD>1</TD></TR> <TR><TD>2</TD></TR> </TABLE>

Page 10: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TR Element (Attributes)

Optional Attributes

None

Page 11: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TD/TH Elements (Basics)

Description: Use the TD/TH element to add table data to the current row of the table

Placement: TD/TH must be a child of TR

Content: Flow content

The difference between TD and TH is that TH is exclusively used in THEAD while TH and TD can both be used in TBODY

Page 12: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TD/TH Elements (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: OPTIONAL

Self-Closing Tag: YES (XML Syntax)

Example

<TABLE> <TR><TH>C1</TH><TH>C2</TH></TR> <TR><TD>1</TD><TD>2</TD></TR> <TR><TD>3</TD><TD>4</TD></TR> </TABLE>

Page 13: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TD/TH Elements (Attributes)

Optional Attributes

COLSPAN: The number of columns this piece of TD data will span.

ROWSPAN: The number of rows this piece of TD data will span.

HEADERS: A string containing a sequence of HTML identifiers that are associated with table headers. Used by speech readers to help the blind make sense of table data.

Page 14: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The THEAD Element (Basics)

Description: Use the THEAD element to mark one or more rows of a table, starting from the first row, as heading rows

Placement: THEAD must be a child of TABLE

Content: Zero or more TR elements.

Page 15: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The THEAD Element (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: OPTIONAL

Self-Closing Tag: YES (XML Syntax)

Example

<TABLE> <THEAD><TR> <TH>1</TH><TH>2</TH><TH>3</TH> </TR></THEAD> </TABLE>

Page 16: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The THEAD Element (Attributes)

Optional Attributes

None

Page 17: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TFOOT Element (Basics)

Description: Use the TFOOT element to mark one or more rows of a table, starting from the bottom row, as footing rows. Useful for summarizing data

Placement: TFOOT must be a child of TABLE

Content: Zero or more TR elements.

Page 18: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TFOOT Element (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: OPTIONAL

Self-Closing Tag: YES (XML Syntax)

Example

<TABLE> <TFOOT><TR> <TD>1</TD><TD>2</TD><TD>3</TD> </TR></TFOOT> </TABLE>

Page 19: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TFOOT Element (Attributes)

Optional Attributes

None

Page 20: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The COLGROUP Element (Basics)

Description: Use the COLGROUP element to apply a CSS style down all rows, spanning a specified number of columns. Useful for coloring columns and grouping data.

Placement: COLGROUP must be a child of TABLE

Content: Zero or more COL elements.

Page 21: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The COLGROUP Element (Syntax)

Requirements

Start Tag: OPTIONAL (read standard)

End Tag: OPTIONAL (read standard)

Self-Closing Tag: YES (XML Syntax)

Example

See the lecture example code for an example since this element uses something we haven’t really covered yet (CSS).

Page 22: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TBODY Element (Basics)

Description: Use the TBODY element to mark one or more rows of a table, starting after the last THEAD row, as body rows.

Placement: TBODY must be a child of TABLE and come after THEAD (if there is a THEAD)

Content: Zero or more TR elements.

Page 23: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TBODY Element (Syntax)

Requirements

Start Tag: OPTIONAL (see standard)

End Tag: OPTIONAL (see standard)

Self-Closing Tag: YES (XML Syntax)

Example

<TABLE> <TBODY><TR> <TD>1</TD><TD>2</TD><TD>3</TD> </TR></TBODY> </TABLE>

Page 24: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The TBODY Element (Attributes)

Optional Attributes

None

Page 25: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

Frames

Very popular in the late 90’s

Really old school and outdated now

HTML5 standard has deprecated the FRAME and FRAMESET elements

One type of frame however, still exists in HTML5, the inline frame element, IFRAME

Page 26: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The IFRAME Element (Basics)

Description: Use the IFRAME to load the contents of another HTML page in a child window within the current document.

Placement: IFRAME is embedded content, and can be placed anywhere flow and phrasing content is expected.

Content: Fallback text, in the case that the web browser does not support inline frames.

Page 27: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The IFRAME Element (Syntax)

Requirements

Start Tag: REQUIRED

End Tag: REQUIRED

Self-Closing Tag: FORBIDDEN

Example

<IFRAME SRC="index.html"> Your web browser does not support inline frames!</IFRAME>

Page 28: Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 4: Tables and Frames

The IFRAME Element (Attributes)

Optional Attributes

SRC: The URL of the document to load within the frame. Can be absolute or relative.

NAME: The name of the frame window (useful when we do JavaScript later on).

WIDTH: The desired width of the frame window.

HEIGHT: The desired height of the frame window.