Html Guide part 2, Tables, and lists


Finally this part of this guide has been made, the first topic that will be explained are Tables, the most difficult formatting in html which usually results in strange fashion if not made properly. Most of the values below have two default setting that they fit into. All pixel values can be arranged with percentages (%) and all percentage values can be represented with pixels. Also tables can have tables inside them and tables can be inside the <cols> or <colgroup> attributes. Also the "alt" of tables called summary. (what you don't know will be explained way later in this somewhat long html guide). You will notice many tags missing in the examples because its pretty much all the same things, it's just that I want to introduce it to you and build on your knowledge of what you don't know and do know.


Table of contents:
Table | Border | Summary | Border width | Bordercolor | Columns | example | Cellspacing | Cellpadding | example 2 | Width | Height | Align | Bgcolor | Table Background | example 3 | Table cell | Table Rows | Row align | Row Valign | Example 4 |
 
 



Since there is no easy way to teach "tables" online, here is a reference list that will be used later all through this guide

Table

Here is what are needed in every table and is the standard for every table
<table cellspacing=1 cellpadding=1 cols=1 >
<tr>
<td>table stuff</td>
</tr>
</table>

But then there are other things that specify the use of tables, but these are included in the table tag.
<Table...........>

Border

Including this attribut tells if you want a border around the table and not putting it in a the tag  would have no border.
(ex)
A table with no borders (def.) A table with borders (1)
<table></table>
a cell b cell
c cell d cell
<table Border></table>
a cell b cell
c cell d cell
Note: there are tables in this table and cells in that table, don't worry, it will be explained later.

Summary
One of the most unused attribute and somewhat never heard of part of html tables. This attribute tells the browser the alt text for  tables (like img's (images) alt property that tells what it is if the picture isn't there). The reason why this is probably never used is because almost no browser has tables off and about every web page has a table somewhere and tables were made since Netscape's 1.0 version of their browser, the property Summary is used rarely and sometimes not even considered or a never heard of part in html, not even in many popular html books!!, but since this makes your page "a little bit better" and gives accessibility "another accessibility star", it well worth it, but consider using this property. This is RARE.
table summary="The layout of my page is in tables and it is most likely that you'll never see this part of html"></table>
(if you don't see a table, that means that is the real example of the summary attribute)
if this is a table, your browser supports tables, if not another message will appear
(Note: consider using this property for your tables, even though i don't use it. :( )
Back to top

Border=#of pixels
This attribute tells how big you want your table border to be in a specific number of pixels.
(ex)
The regular default border(1) The border is 5 pixels big
<table border></table>
this is
a table
<table border=5></table>
this has a
5 pixel  border
(note: this is not affective without the Border attribute)

Bordercolor=hexademical value or color
This attribute specifies the color of the tables border( the outer part of the table)
(ex)
Default table (gray/white)  table with red border
<table border></table>
default gray
border table
<table bordercolor="red"></tab
table with
red border
Note: this effect will no work if you set the border to 0 pixels or don't include the border attribute.

Cols
This attribute tells how much columns the table has (if it only has 1 column, then this is not required, but with 2 or more, it is required) if there is more than columns. Without this attribute, you can't use table cells, table rows and other stuff that are explained later.
(ex)
A regular one column table this is a regular two column table
<table cols=1></table>
this is a one
column table
<table cols=2></table>
this is a
two cols table
Note: that the <td> tags are not explains here. The cols property is used to specify how much columns the table will have.

Just for fun, here is a table with all the attributes listed.
<table border="5" bordercolor="red" Summary="this is a table" cols="2" ></table>
this has a 5 pixel wide table with a border
which the bordercolor is Red
Note: this kind of table is useful if you want to make a table like button.
Back to top


Cellspacing
This property determines the spacing between cells
(ex)
The default standard for cellspacing This table has a cellspacing of 5 This table has a table cellspacing of 0
<table cellspacing=1></table>
This is a default
cellspacing table (1)
<table cellspacing=5></table>
this table has a cellspacing
of  5
<table cellspacing=0></table>
This cell has a cellspacing of
0 (zero)
Note: this part is a standard, but can be set to cellspacing=0 to make it look regular for things like buttons.


Cellpadding
This property determines the padding of the cells within the cells of the table (means spacing within the cell)
(ex)
The default standard for the Cellpadding property (1) this has a cellspacing of 5
<table cellpadding=1></table>
this is a default
cellspacing table of 1
(notice that the words are aligning with the table>
<table cellpadding=5></table>
this is a table with the cell padding of 5 in the table w-
which illustrates that it has  space within the cells
(notice that the words are slightly off the part of the table

Example B of everything shown and compiled together
<table border="5" bordercolor="red" Summary="this is a table" cellspacing="5" cellpadding="5" cols="2"></table>
this is example B of 5  cellspacing and
5 cellpadding, 5 border  border red
Back to Top



Width
This property determines the width (the part that goes left to right) of the table, the value will be the percentage or pixel value of window (percentage or pixel value of how big the table will be in the window).
(ex)
Default width of table 100% of parent cell a table width of 68% of the parent cell
<table width=100%></table.
this is the default width of
an somewhat average table
(the percentage or pixel value means of the parent cell)
a table that will always go width
the size of the parent window
(play with this and resize the window, and notice the change)


Height
Like the width attribute, but except it is the height of the table.
(ex)
regular as usual (default) a 40 pixel high table
<table></table>
regular default height (about 20 pixels big)
<table height="40"></table>
this has 40 pixels in  length!
Note: the height in pixels varies from different kinds of screens and also the percentage of the height.


Align
this property aligns tables and determines where they are placed in the parent cell (works like text formatting)
(ex)
left aligned table (default) center aligned right aligned
<table align=left></table>
cell cell
cell cell
the left part isn't necessary, but doesn't
hurt the alignment of the table
<table align=center></table>
cell cell
cell cell
<table align=right></table>  
cell cell
cell cell
(note: it has no effect if the child table is 100% or bigger than the parent window or is not that noticeable


Bgcolor
This property is used for making a table color for the table
(ex)
a default table with no colors :( a table with the color orange :)
<table></table>
a white table white
blue cell
<table bgcolor=orange></table>
a cool orange cell orange
cell orange cell
Note: other things such as cells can override the usage of tables color and change the cell itself

Background
This property specifies the background image for the table, unlike td's or td's background, the whole table is rather tiled or centered if the image is right. Also, if you include the background property, you must get rid of the bgcolor property because it is useless against this property.
(ex)
A regular color (the color is light green instead of the default) This table has a background image
<table bgcolor="66FF99'></table>
this is a light
green colored table
<table background="background_name.gif"></table>
This has a back ground image
called "background.gif"
Note: that both properties can be used together only if you want the bgcolor=color for non-image users and background="background_name.gif" can be with users with images.
 

Example of everything shown 3
<table border=5 bordercolor="red" cellspacing=5 cellpadding=5 width=67% bgcolor="orange" align=center height=40 Summary="this is a table" cols="2"></table>

cool example of everything shown in this
cool looking weird  table

Introduction of Cells and Cell Rows

This starts the cell section, even though this is not even close to one fourth of the way, its a start. This section starts the cell part and row part in the tables property, which is with all the necessary tags that are needed, but were never there before are:
<table cellspacing=1 cellpadding=1 border bordercolor=green>
<TR>
<td>a cell</td> <td>b cell</td>
</TR>
<TR>
<td>c cell</td> <td>d cell</td>
</TR>
</table>
(ex)
<TR> <td>a cell</td> <td>b cell</td> </TR>
<TR> <td>c cell</td> <td>d cell</td> </TR>.

Note: That all cells with different properties requires an end </td> tag, but isn't necessary if the cell doesn't need any formatting, but still it should still be there even without formatting to get in a habit of it. Also the following are the new tags being introduced in this part.

<TR></TR>-Means Table Row and must contain the <td></td> (table cell) attribute inside them.
<TD></TD>-Means table cell and are contained inside the <TR> (table row) value.



First I will somewhat introduce the <TR> (table row) tag first without the table attribute.
<tr>
<td>a cell</td></td>bcell</td>
</tr>
(ex)
<TR>
<td>a cell</td> </td>b cell</tr>
</TR>
Note: The number of cells in a row must be the same for almost all the rows, but there are exceptions.

<tr align=Left | Right | Center>
This property is more likly for things inside the row, than the row itself.
(ex)
<tr align=left></tr>
You know what i'm going to do, im going to use default (L)
<tr align=center></tr>
this part will be centered
<tr align=right></tr>
This will be right align
<tr align=char></tr>
this is the weird, but unused char
Note: there are more properties, but don't worry

<tr valilgn= top | center | bottom | baseline>
This property shows the valign of up and down, and can be combined with align=left etc.
(ex)
<tr valign=top></tr>
this is top
<tr valign=center></tr>
this is a center
<tr valign=bottom></tr>
this is a bottom
<tr valign=baseline></tr>
this is a baseline
Note: this probably has no affect, but is a key concept of html

now that i'm done with rows (not enough info, right?), but later i will teach you how to use tables, and put them together without going our the easy way (i did, but still you should know what you are doing.)



Example of everything shown 4
<table border=5 bordercolor="red" cellspacing=5 cellpadding=5 width=67% bgcolor="orange" align=center height=40 Summary="this is a table" cols="2">
<tr background="background_name.gif"></tr>
<tr align="center"></tr>
</table>
cool example which uses the back- ground property of the row
background color for the table, and  othe cool stuff i like to do.
Note: i haven't yet included the td cell property, which will explain lots of html problems


Tables cells and how are they used

Here is a list of the elements and quick reference before I explain them, because this is where it starts to get complicated.
 
<td align= left, right, center></td> makes the text center, right or center
<td valign=top, middle, bottom makes the text top, middlem, or bottom
<td colspan=# of cells spanned used to make regular cells occupy more cells
<td rowspan=# of rows spanned used to make regular cell occupy more rows
<td width=# of pixels or percentage  tell how big the cell is in the tables
<td bgcolor= rgb, hexadenical, color the background color of the cell.

introduction of how these are used
this is probably the most hardest thing in html to use because it has so much properties and that they depend of the browser to calculate whay it should look like. There are many tricks to avoid certain elements and tables, also consider using css, which can almost eliminate tables aligning and things like that. Please consider using tables to present your page than frames, or even lists (explained way later)

<Td align="left, right, center"></td>
As always, i will show the example as the default and other properties, even though they may not always work.

(ex)
 
This property will show how the alignment of tables can work affectively 
<td align="left" ............></td>(default)
<td align="center" ..........></td> (center)
<td align="right ..............></td> (right)

 
 
 
 
 

Copyright 2001 by rocdragon12. All rights reserved

Hosted by www.Geocities.ws

1