Introduction to Programming the WWW I CMSC 10100-1 Summer 2004 Lecture 5
Today’s Topics • HTML Tables (cont’d) • HTML Frames • HTML Forms
2
Review: Typical Table Sketch Code
Sample Table headrow-col1 | … headrow-coln |
row1-col1 | … row1-coln |
… rowm-col1 | … rowm-coln |
sampletable.html
3
Tables and Text • Text is hard to read against a busy background
pattern, but you can lay a table containing text on top of a background pattern without sacrificing readability (just give the table a solid background color) Examples: table_text2.html vs. table_text1.html
• Tables can also be used to separate text into two
columns (a cellpadding=“20” table attribute will put white space between the two columns) Example: table_2col.html 4
Tables and Graphics • Tables can be used to control a Web page layout for multiple images (or images mixed with text)
• Images of different sizes can be fit together in irregularly-shaped tables using cell-structure diagrams
• All tables have an underlying cell structure with a
uniform number of table cells across each table row 5
Web Page Borders • Empty table columns can be used to create margins for text on a Web page
Use a fixed width attribute (e.g. width=“50”) for the empty table data element
• Put an internal table inside Example: innertable.html
• Note: better to control margins with CSS
6
One vs. Many • If you have one very large table, try to break it up into a
sequence of smaller tables that can be stacked vertically on a Web page
• Browsers download the contents of an entire table before any of the table can be viewed
• Multiple tables will be displayed incrementally so the user will be able to see the first part of your page while the rest of the page is still downloading 7
Disadvantages of tables for layout • Complex layout requires complex tables (lots of headaches, room for error) • Complex tables can download, be rendered slowly • Scalability issues Not all browsers can read tables
8
HTML Frames • HTML frames allow to display multiple HTML documents in a same browser window
The browser window is divided into multiple regions, or frames Each frame displays a unique web page Each frame is independent of the others
9
Frame Code Structure
…