when I need to use colspan ?
I am not comfortable using colspan in HTML table. I dont understand under what circumstances one should be use colspan.
Can anybody please explain situations where colspan needs to be used.
You use 'colspan' on a <td> to set the number of columns in your table that you want the <td> to occupy. This is typically used when there will be rows in your <table> that will have a different number of columns. For example:
<td colspan="2">Two columns of data</td>
Ok. Thaks for the post.
We could just use a blank td with nbsp ? Why colspan ?
It's a matter of controlling the appearance of the table. If your rows have different numbers of columns and you don't use colspan anywhere, the browser will decide for itself which <td> to expand to the full width of the table.
Also, if you use borders in your tables, it will be noticeable that you have a <td> tag with a nbsp in it.
Table cells can span across more than one column or row. The attributes COLSPAN ("how many across") and ROWSPAN ("how many down") indicate how many columns or rows a cell should take up.
For example, we might want to create header cells for each department in our table of names and phone numbers. In this table, the header cells in the first and fifth rows span across two columns to indicate the department for each group of names.
<TABLE BORDER=2 CELLPADDING=4>
<TR> <TH COLSPAN=2>Production</TH> </TR>
<TR> <TD>Raha Mutisya</TD> <TD>1493</TD> </TR>
<TR> <TD>Shalom Buraka</TD> <TD>3829</TD> </TR>
<TR> <TD>Brandy Davis</TD> <TD>0283</TD> </TR>
<TR> <TH COLSPAN=2>Sales</TH> </TR>
<TR> <TD>Claire Horne</TD> <TD>4827</TD> </TR>
<TR> <TD>Bruce Eckel</TD> <TD>7246</TD> </TR>
<TR> <TD>Danny Zeman</TD> <TD>5689</TD> </TR>
which gives us:
Raha Mutisya 1493
Shalom Buraka 3829
Brandy Davis 0283
Claire Horne 4827
Bruce Eckel 7246
Danny Zeman 5689
A milling machine is a machine tool used to machine solid materials. Milling machines are often classed in two basic forms, horizontal and vertical, which refer to the orientation of the main spindle. Both types range in size from small, bench-mounted devices to room-sized machines.
Liquid Filling Machine
Tables are terrible! Use div tags.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)