(X)HTML - getting two cells to span three columns - possible?

Soldato
Joined
7 Mar 2005
Posts
19,548
Location
LU7
I'm putting together a hard-coded page with a table on it, kind of for work. I'm in charge of updating the website but I've been given Frontpage 2000 to use and it is starting to wind me up how inflexible it is and how much superfluous code it produces. If there's an error in how something is shown I find it quite hard to fix as there's just so many tags being used it is like hunting down a needle in multiple haystacks!

So I've kind of started doing this page to show how it is possible, using hard-coded XHTML, to produce a nicer looking page that downloads quicker due to valid code as well as using less code to achieve the same as the page I'm trying to replace.

I've done a table but I've got two cells that I could do having span over three columns. Basically the table shows what pupils will be studying in each subject for the three terms in a school year. Most subjects cover just one term so no problems there. However I've got two subjects that both cover 1.5 terms. How can I get these two cells to span three rows? I've used
Code:
colspan="2"
on both to see if I could trick the table into letting both cells span the three columns. It didn't work and the first cell is the one that spans two columns whilst the second cell just fills up the third column.

Is it possible to get a table that can have two cells spanning three columns? If it is could someone give me a hint on how to code for this? I have done some googling but whenever I search for table span stuff I just get loads of websites telling me how to span rows and columns. I already know this stuff, it is the advanced art of spanning I'm looking for. I've already checked out HTMLDog.com and W3Schools.com but I've not found anything beyond the standard span stuff on either.
 
You can't get two cells to span three columns equally.

Your best bet is to seperate the table in to 6 columns, 2 for each term.

So a normal row would be:

<tr>
<td colspan=2"></td><td colspan=2"></td><td colspan=2"></td>
</tr>

And the 1.5 term subjects would be:

<tr>
<td colspan="3"></td><td colspan="3">
</tr>
 
I was thinking it would be nigh on impossible. I like the idea of the 6 columns for the table. It's all maths isn't it! 3 divided by 2 is not a whole number. 6 divided by 3 is! :D

Thanks for the suggestion Ekim, I was thinking of something along those lines. I'll do this. :)

Update: Just had to check via Google that I could use colspan and rowspan in the same cell. Thankfully I can and it was just a case of using both a la:
Code:
<td colspan="3" rowspan="2">bla bla bla</td>
:cool:
 
Last edited:
Back
Top Bottom