tables 1. in this chapter you will learn that tables have many uses in html. objectives: upon...

28
1

Upload: chad-cameron-jennings

Post on 13-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

1

Page 2: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

In this chapter you will learn that tables have many uses in

HTML. Objectives:Upon completing this section, you should be able to:1. Insert a table.2. Explain a table’s attributes.3. Edit a table.4. Add a table header.

2

Page 3: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

First Name

Last Name

Address City

3

Tables

Table Row

Table Header

Data Cell

Colored Row

Page 4: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

The <TABLE></TABLE> element has four sub-elements:

1. Table Row<TR></TR>.2. Table Header <TH></TH>.3. Table Data <TD></TD>. The table row elements usually contain

table header elements or table data elements.

4

Page 5: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

<table border=“1”><tr><th> Column 1 header </th><th> Column 2 header </th></tr><tr><td> Row1, Col1 </td><td> Row1, Col2 </td></tr><tr><td> Row2, Col1 </td><td> Row2, Col2 </td></tr></table>

5

Page 6: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Column 1 Header Column 2 Header

Row1, Col1 Row1, Col2

Row2, Col1 Row2, Col2

6

Page 7: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

BGColor: Some browsers support background colors in a table.

Width: you can specify the table width as an absolute number of pixels or a percentage of the document width. You can set the width for the table cells as well.

Border: You can choose a numerical value for the border width, which specifies the border in pixels.

CellSpacing: Cell Spacing represents the space between cells and is specified in pixels.

7

Page 8: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

CellPadding: Cell Padding is the space between the cell border and the cell contents and is specified in pixels.

Align: tables can have left, right, or center alignment.

Bgcolor: Sets background color for table BorderColor, BorderColorDark. Cols: Number of columns.

8

Page 9: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Align: Horizontally aligns row (LEFT, CENTER, RIGHT, JUSTIFY)

Bgcolor: Sets background color for row Valign: Vertically aligns row (TOP, MIDDLE,

BOTTOM)

9

Page 10: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Table Data cells are represented by the TD element. Cells can also be TH (Table Header) elements which results in the contents of the table header cells appearing centered and in bold text.

10

Page 11: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Colspan: Specifies how many cell columns of the table this cell should span.

Rowspan: Specifies how many cell rows of the table this cell should span.

Align: cell data can have left, right, or center alignment. Valign: cell data can have top, middle, or bottom

alignment. Width: you can specify the width as an absolute number

of pixels or a percentage of the document width. Height: You can specify the height as an absolute

number of pixels or a percentage of the document height.

11

Page 12: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

<TABLE BORDER=1 width=50%><CAPTION><h1>Spare Parts

<h1></CAPTION> <TR><TH>Stock Number</TH><TH>Description</TH><TH>List Price</TH></TR><TR><TD bgcolor=red>3476-AB</TD><TD>76mm Socket</TD><TD>45.00</TD></TR>

12

<TR><TD >3478-AB</TD><TD><font color=blue>78mm

Socket</font> </TD><TD>47.50</TD></TR><TR><TD>3480-AB</TD><TD>80mm Socket</TD><TD>50.00</TD></TR></TABLE>

Page 13: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

<Table border=1 cellpadding =2><tr> <th> Column 1 Header</th> <th> Column 2 Header</th> </tr><tr> <td colspan=2> Row 1 Col 1</td> </tr><tr> <td rowspan=2>Row 2 Col 1</td> <td> Row 2 Col2</td> </tr><tr> <td> Row 3 Col2</td> </tr></table>

13

Page 14: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Column 1 Header Column 2 Header

Row 1 Col 1

Row 2 Col 1

Row 2 Col 2

Row 3 Col 2

14

Row Span

Column Span

Page 15: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

TH, TD and TR should always have end tags.Although the end tags are formally optional, many browsers will mess up the formatting of the table if you omit the end tags. In particular, you should always use end tags if you have a TABLE within a TABLE -- in this situation, the table parser gets hopelessly confused if you don't close your TH, TD and TR elements.

A default TABLE has no bordersBy default, tables are drawn without border lines. You need the BORDER attribute to draw the lines.

By default, a table is flush with the left marginTABLEs are plopped over on the left margin. If you want centered tables, You can either: place the table inside a DIV element with attribute ALIGN="center".Most current browsers also supports table alignment, using the ALIGN attribute. Allowed values are "left", "right", or "center", for example: <TABLE ALIGN="left">. The values "left" and "right" float the table to the left or right of the page, with text flow allowed around the table. This is entirely equivalent to IMG alignment

15

Page 16: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

16

Page 17: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

17

Page 18: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Colors are set using “RGB” color codes, which are, represented as hexadecimal values. Each 2-digit section of the code represents the amount, in sequence, of red, green or blue that forms the color. For example, a RGB value with 00 as the first two digits has no red in the color.

18

Page 19: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

19

Main Colours

Page 20: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

20

RGB Colour Model

Page 21: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

21

Page 22: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

1. WHITE2. BLACK3. RED4. GREEN5. BLUE6. MAGENTA7. CYAN8. YELLOW9. AQUAMARINE10. BAKER’S CHOCOLATE11. VIOLET12. BRASS13. COPPER14. PINK15. ORANGE

1. #FFFFFF2. #0000003. #FF00004. #00FF005. #0000FF6. #FF00FF7. #00FFFF8. #FFFF009. #70DB9310. #5C331711. #9F5F9F12. #B5A64213. #B8733314. #FF6EC715. #FF7F00

22

Page 23: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

These attributes control the colors of the different link states:

1. LINK – initial appearance – default = Blue.2. VLINK – visited link – default = Purple.3. ALINK –active link being clicked–default=

Yellow.The Format for setting these attributes is:<BODY BGCOLOR=“#FFFFFF” TEXT=“#FF0000”

LINK=“#0000FF” VLINK=“#FF00FF” ALINK=“FFFF00”> </BODY>

23

Page 24: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Special Character

Entity Name

Special Character

Entity Name

Ampersand &amp; & Greater-than sign

&gt; >

Asterisk &lowast; ∗∗

Less-than sign &lt; <

Cent sign &cent; ¢ Non-breaking space

&nbsp;

Copyright &copy; © Quotation mark &quot; "

Fraction one qtr

&frac14; ¼

Registration mark

&reg; ®

Fraction one half

&frac12; ½

Trademark sign

&trade; ™ 24

Page 25: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Additional escape sequences support accented characters, such as:

&ouml; ◦ a lowercase o with an umlaut: ö

&ntilde; ◦ a lowercase n with a tilde: ñ

&Egrave; ◦ an uppercase E with a grave accent: È

NOTE: Unlike the rest of HTML, the escape sequences are case sensitive. You cannot, for instance, use &LT; instead of &lt;.

25

Page 26: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

<IMG>This element defines a graphic image on the page.

Image File (SRC:source): This value will be a URL (location of the image) E.g. http://www.domain.com/dir/file.ext or /dir/file.txt.

Alternate Text (ALT): This is a text field that describes an image or acts as a label. It is displayed when they position the cursor over a graphic image.

Alignment (ALIGN): This allows you to align the image on your page.

26

Page 27: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

Width (WIDTH): is the width of the image in pixels.

Height (HEIGHT): is the height of the image in pixels.

Border (BORDER): is for a border around the image, specified in pixels.

HSPACE: is for Horizontal Space on both sides of the image specified in pixels. A setting of 5 will put 5 pixels of invisible space on both sides of the image.

VSPACE: is for Vertical Space on top and bottom of the image specified in pixels. A setting of 5 will put 5 pixels of invisible space above and bellow the image.

27

Page 28: TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert

1) <IMG SRC=“jordan.gif“ border=4>2) <IMG SRC=" jordan.gif" width="60"

height="60">3) <IMG SRC=“jordan.gif" ALT="This is a

text that goes with the image">4) <IMG SRC=" jordan.gif “ Hspace="30"

Vspace="10" border=20> 5) < IMG SRC =" jordan.gif“ align="left">blast blast blast blast blast

28