Table formatting problems (html)

Status
Not open for further replies.
Hi,

I'm using ColdFusion and I'm outputting data into a regular html table. My problem is that one field in the table can have many rows in it, but the rest of the fields will only have 1 row, like so:

Name Subject Mark Year
Dave Math 56 2002
79
82

John Math 69 2002

etc....

Anyone know how to help me format this in a table? Right now I'm only doing:

<tr>
<td>Name goes here</td>
<td>Subject goes here</td>
<td>Mark goes here</td>
<td>Year goes here</td>
</tr>
Obviously this isn't working out very well. Any suggestions?

thanks

PS: the 79 and 82 are supposed to be under the 59...
 

timob

Seniorius Lurkius
21
Or you could use a rowspan attribute on the other columns. You need to know in advance how many marks a student has to define the rowspan.

code:<HR>
Code:
<table >
  <tr>
    <td>Name</td>
    <td>Subject</td>
    <td>Mark</td>
    <td>Year</td>
  </tr>
  <tr>
    <td rowspan="3">Dave</td>
    <td rowspan="3">Math</td>
    <td>56</td>
    <td rowspan="3">2002</td>
  </tr>
  <tr>
    <td>79</td>
  </tr>
  <tr>
    <td>82</td>
  </tr><P> etc
</table>
 

cikkolata

Ars Scholae Palatinae
836
Originally posted by MaximDiscord:
You will need to use empty rows in all of the columns that don't need the extra space. Just throw a 1 pixel gif in the empty rows and fill the important rows with pertinent information.

Thats how I have done it in the past anyway,

I've always used &nbsp; in my empty cells, does it really make any difference?
 

Fluogen

Ars Tribunus Angusticlavius
7,268
I know you said that worked but I think it looks much nicer using colspan instead.

code:<HR>
Code:
<table >
	<tr>
		<td>Name</td>
		<td>Subject</td>    
		<td>Mark</td>    
		<td>Year</td>  
	</tr>
	
	<tr>
		<td>Dave</td>
		<td>Math</td>    
		<td>56</td>    
		<td>2002</td>  
	</tr>
	<tr>
		<td colspan="2"> </td>
		<td>79</td>
		<td> </td>  
	</tr>
	<tr>
		<td colspan="2"> </td>
		<td>82</td>
		<td> </td>
	</tr>
</table>
 
Status
Not open for further replies.