[ Pobierz całość w formacie PDF ]
.6.To achieve this goal, we will use the code in Listing 10.2.Listing 10.2.A simple table.<TABLE ALIGN=RIGHT BORDER=3 BORDERCOLOR=#4682B4 WIDTH=30%><CAPTION ALIGN=TOP VALIGN=TOP>The caption here</CAPTION><TR><TH BGCOLOR=#4682B4>Head 1</TH><TH BGCOLOR=#4682B4>Head 2</TH><TH BGCOLOR=#4682B4>Head 3</TH></TR><TR><TD>info a</TD><TD>info b</TD><TD>info c</TD></TR></TABLE>Now let's make sure you understand what this code means.The first element in the table is the <TABLE> tag itself.This tag is just telling the Web browser that what follows is to be laid out as a table.In our example we use the following attributes for our <TABLE> tag:ALIGN=This specifies the alignment of the table as in:<ALIGN=RIGHT>Other possibilities for this attribute include ALIGN=LEFT and ALIGN=CENTER.BORDER=This causes a border to be placed around the table, specified by a numerical value.In this case,<BORDER=3>causes a border to be placed around the table 3 pixels wide.BORDERCOLOR=This defines the color of the border (A Microsoft Internet Explorer 3.0 attribute), as in <BORDERCOLOR=#4682B4>You can either use a hexadecimal color (as in our example) or use one of Microsoft's specified color names (for example, BORDERCOLOR=RED).This attribute must be used in conjunction with BORDER=; otherwise, there is no border to color.WIDTH=This specifies how wide the table will be, either in pixels or as a percentage, as in <WIDTH=30%>Other attributes you could use for the <TABLE> tag include BACKGROUND, BGCOLOR, BORDERCOLORDARK, BORDERCOLORLIGHT, CELLSPACING, CELLPADDING, FRAME, HEIGHT, RULES, and VALIGN.See the HTML reference, Appendix H of this book, for a full explanation of these tags.The next tag in our example table is the <CAPTION> tag, which can be used to put a label on your table.In our example we use the following attributes for our <CAPTION> tag:ALIGN=Used to align the caption, as in:<ALIGN=TOP>Other possibilities for this attribute include BOTTOM, LEFT, RIGHT, or CENTER.VALIGN=Instructs whether to place the caption on top or below the table, as in VALIGN=TOP or VALIGN=BOTTOM.<TR>Stands for Table Row and contains a row of table cells.All tables must include at least one <TR> element.Attributes for <TR> can include ALIGN, BACKGROUND, BGCOLOR, BORDERCOLOR, BORDERCOLORLIGHT, BORDERCOLORDARK, COLSPAN, NOWRAP,ROWSPAN, and VALIGN.<TH>Identifies a table heading cell.We used the BGCOLOR attribute, which can be defined as a hexadecimal value or by name as it appears in our example:<TH BGCOLOR=#4682B4>Head 1</TH>Other attributes for this tag include ALIGN, BACKGROUND, BORDERCOLOR, BORDERCOLORLIGHT, BORDERCOLORDARK, COLSPAN, NOWRAP, ROWSPAN, and VALIGN.<TD>Used to define a table data cell, as in
[ Pobierz całość w formacie PDF ]