Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using HTML tables.... Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment.

Similar presentations


Presentation on theme: "Using HTML tables.... Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment."— Presentation transcript:

1 Using HTML tables...

2 Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment Padding the columns and Rows Spanning Columns and Rows Special Examples Creating page layouts

3 Competency Objectives 1.Can create a table of elements 2.Can add color, alignment, size 3.Understand some of capabilities of tables 4.Can use tables for layout Competency Alert: You need to know this ! Common Problem Area! People seem to forget this

4 HTML Tables l An orderly arrangement of text and/or graphics into vertical columns and horizontal rows. l Within HTML tables perform many functions »Control web page layout (for text and graphics) »Separate a Web page into different areas »Show data output in traditional table format

5 A couple of table examples... http://arnb.com/webdesign/chap5/tables/advert.htm A table used as a page layout device A simple table Competency Alert: You need to know this !

6 HTML Tables Organization l Tables are organized by rows and columns Each these are called a “cell”

7 The Basic Table Structure The bare minimum tags needed to describe a table are …, … Defines the start and end of table Defines the start and end of a table row Defines the start and end of a table data item in a row.

8 The Basic Table Structure Simple Table Cell 1 Cell 2 Cell 3 Cell 4 Table Row Table data (column) Start & End Table Competency Alert: You need to know this !

9 Not all rows need not be same the size Notice you do not need same columns in each row Cell 1 Cell 2 Cell 1 Cell 2 Cell 3

10 How ‘null’ columns are treated What would the following display? Cell1 Cell2 Cell ? Cell 1 Cell 2 Cell 3 Row 1 has 5 cols, Col 3-4 empty, col 5 has cell ? Row 2: Cols 1-3 only have data

11 Using for Table Headers Use the tag for Table headers. Each element within is made bold and centered Character Description Frodo The ring bearer, that is, he carries the ring. Sam Frodo's trusted assistant. He carries the stuff (and Frodo too sometimes) Automatic Bold & center Competency Alert: You need to know this !

12 Not closing tags in tables. Tables are another example of how ‘wrong’ html displays correctly. My First Table Description Size Weight Gun 5 Inch Barrel 20 Ounces T-Rex 40 Feet High Multiple Tons Hurricane Floyd 400 Miles Radius ???? No, tag Missing and tag Common Problem Area! People seem to forget this

13 Tables Are Their Own Environment Simple Table Character Description Frodo The ring bearer, that is, he carries the ring. Sam Frodo's trusted assistant. He carries the stuff (and Frodo too sometimes) Is this line italics or not? You might think each table cell would be default italics Line AFTER table still gets italics. Italics is turned off after the cell. Common Problem Area! People seem to forget this

14 Table Cells Format Like Documents... Test A litte 'tune' Happy Days Are here again. The skies are are blue again But my favorite 'tune' is: Create a ol within this cell. Format some text. Include an image centered. Competency Alert: You need to know this !

15 Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment Padding the columns and Rows Spanning Columns and Rows Special Examples Creating page layouts

16 Table Attributes Row and Column Width Some other attributes for the tag width=number, percentage - specifies the width (in pixels) of entire window or % of size of current element. (Can be set at table, row or cell level.) height=number, percentage - specifies the height (in pixels) of entire window or % of size of current window. (Can be set at table, row or cell level.)

17 Specifying Column Size My First Table Description Size Weight Gun 5 Inch Barrel 20 Ounces T-REX 40 Feet High Multiple Tons Hurricane Floyd 400 Miles Radius ???? Set overall table size Specify per column or one for overall. Notice how browser overrides the 10% column to ‘even’ column out.

18 Using Percentages fills to current window size. My First Table Description Size Weight Gun 5 Inch Barrel 20 Ounces T-REX 40 Feet High Multiple Tons Hurricane Floyd 400 Miles Radius ???? If specify width and height as percentage, browser will automatically resize table

19 Other table attributes: Borders border=# - 0 or no border is the default Simple Table Character Description Frodo The ring bearer, that is, he carries the ring. Sam Frodo's trusted assistant. He carries the stuff (and Frodo too sometimes) Is this line italics or not? Border = 0 And border=10

20 Options: Background Color bgcolor="#rrggbb" or color name - sets a color for background for table or table cell. Can specify bgcolor for overall table background, for a row, and for a column. Column specification overrides row Row specification overrides table specification

21 Table bgcolor example... Color MyTable Color My World - Chicago As time goes on I realize just what you mean to me. But now, now that your near Promise your love That I've waited to share And dreams of our moments together Color my world with hope of loving you Set default table background to red Use green for row Override table and row color and make column yellow

22 Attributes: Alignment Some other attributes for the table tag align=left|right|center – sets the horizontal alignment for a table, row, or cell. Can be used with, or tags. valign=top|bottom|middle – set the vertical alignment of the table, row or cell. Can be used with,, or tags.

23 Alignment Attributes My First Table Name Rank Serial Number George Washington General 1 George Bush President 42 George Ryan ??? ????? Right justify Center justify

24 Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment Padding the columns and Rows Spanning Columns and Rows Special Examples Creating page layouts

25 A Definition Style Table My First Table HTML HyperText Markup Language. It is the language you develop web pages in. You use the result of HTML without even knowing it. (Web Page Design)

26 Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment Padding the columns and Rows Spanning Columns and Rows Special Examples Creating page layouts

27 Cell padding and cell spacing Cell padding specifies the number of pixels from the cell border to the text. Useful for simple announcement boxes. Cell spacing specifies number of pixels between cells of the table. Spacing number of pixels between cells Padding number of pixels from cell border to text

28 Cell Padding Announcement Box Color MyTable The Local News Announcing Earlier Class Dismissal Today! Padding of 52 from border to text A single cell table

29 Using Cell Spacing... 1. Cell Spacing 2. 3. 4. The Local News 5. 6. 7. DATA1 DATA2 8. DATA3 DATA4 9. 10. 11. Cell Spacing of 50

30 Attributes: colspan and rowspan colspan - Allows a cell to span columns rowspan - Allows a cell to span rows These are useful for performing a page layout

31 Column & Row Spacing Colspan - span more than 1 cell column. This row has colspan=2 This row has colspan=3 This row has colspan=2

32 Colspan Example 3 rows & Cols. The first row spans all cols! Spanning columns Colspan Your title here TEXT Text TEXT TEXT TEXT <TD BGCOLOR="ORANGE">TEXT

33 Using Rowspan Rowspan allows 1 cell to span more than 1 rows of cells. This col has rowspan=3 This col spans both cols rowspan=2 This col has rowspan=3

34 RowSpan Example 3 rows & Cols. The first colomn spans all rows! Rowspan My Page Visit uncle's site my dad's site my site other stuff TEXT TEXT TEXT TEXT TEXT

35 A Narrow Column My First Table Now IS The Time For All Good Men To Come To The Aid Of Their Country.

36 Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment Padding the columns and Rows Spanning Columns and Rows Special Examples Creating page layouts

37 Creating Layouts Suppose you want to make a page layout as follows: This Coloumn has colspan 5 Title NavigationNavigation Main Page rowspan 4 Rowspan 4 Colspan 4 Your Logo

38 Wouldn’t this solve the problem? Sample Table Title Nav1 Nav2 Nav3 Main Body 1 st col15% of screen Span the title 4 columns Put Nav Items in bullet list Put Main Body in Navigation not upper right hand corner Title and body not centered

39 Lets Refine It... Sample Table Title Nav1 Nav2 Nav3 <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0> Main Body Center In cell Start a new table that is 100% of remaining space. Align in center of cell Valign at Top Of cell

40 Would Output...

41 Precisely Placing text Need to sub-divide this cell to precisely place this text

42 One possible method Sample Table Title Nav1 Nav2 Nav3 Main Body Copyright by me 2005

43 Review of homework Look at homework file at http://www.rivastudio.cn/?page_id=28 Also don’t forget to include a link on your home page

44 Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment Padding the columns and Rows Spanning Columns and Rows Special Examples Creating page layouts


Download ppt "Using HTML tables.... Objectives... How to create tables Basic,, tags Some arguments with table Height, width, border Special “tricks” Cell text alignment."

Similar presentations


Ads by Google