/    Sign up×
Community /Pin to ProfileBookmark

table colspan question

Okay so I have

[code]
<table border=”1″ style=”text-align:center;”>
<tr>
<td colspan=”60″>a</td>
</tr>
<tr>
<td colspan=”30″>a</td>
<td colspan=”30″>a</td>
</tr>
<tr>
<td colspan=”20″>a</td>
<td colspan=”20″>a</td>
<td colspan=”20″>a</td>
</tr>
<tr>
<td colspan=”15″>a</td>
<td colspan=”15″>a</td>
<td colspan=”15″>a</td>
<td colspan=”15″>a</td>
</tr>
<tr>
<td colspan=”12″>a</td>
<td colspan=”12″>a</td>
<td colspan=”12″>a</td>
<td colspan=”12″>a</td>
<td colspan=”12″>a</td>
</tr>
</table>
[/code]

you can see an example at
[url]http://www.flashsummit.com/test.php[/url]

The problem is that I would like every cell in my each row to be equal sizes instead of how it is now with some cells being bigger than others. Is there a way to do this? If not, could i do it with <div>? And how would i do it with <div> if I could do it with that. Thanks for your time and I appreciate any offers of help you can give.

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@zingmatterMar 08.2006 — colspan isn't for sizing table cells, it's for when you have a row with say 2 cells and the next row only 1 cell. Thus <td colspan="2"> on the second row.

You can use width attribute in the td either in pixels or a percentage. You can also use a style attribute containing some CSS.

Hope this helps
Copy linkTweet thisAlerts:
@NogDogMar 08.2006 — Tableless version:
[code=html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<title>Page title</title>
<style type="text/css">
<!--
#container {
margin: 0 auto;
background-color: #6cc;
padding: 2px;
width: 156px;
}
#container p {
float: left;
margin: 2px;
padding: 2px;
background-color: #ffc;
text-align: center;
}
.cl {
clear: left;
}
.clear {
font-size: 0;
margin:0;
padding: 0;
clear: both;
}
.row1 { width: 148px }
.row2 { width: 70px }
.row3 { width: 44px }
.row4 { width: 31px }
.row5 { width: 23.2px }
-->
</style>
</head>
<body>
<div id="container">
<p class="row1">a</p>
<p class="row2 cl">a</p>
<p class="row2">a</p>
<p class="row3 cl">a</p>
<p class="row3">a</p>
<p class="row3">a</p>
<p class="row4 cl">a</p>
<p class="row4">a</p>
<p class="row4">a</p>
<p class="row4">a</p>
<p class="row5 cl">a</p>
<p class="row5">a</p>
<p class="row5">a</p>
<p class="row5">a</p>
<p class="row5">a</p>
<div class="clear"></div>
</div>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@waffleauthorMar 09.2006 — Zing,

I tried setting the widths in pixels and it didn't seem to be working, what am I doing wrong?
<i>
</i>&lt;table border="1" style="text-align:center;" width="350"&gt;
&lt;tr&gt;
&lt;td colspan="60" width="300"&gt;a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="30" width="150"&gt;a&lt;/td&gt;
&lt;td colspan="30" width="150"&gt;a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="20" width="100"&gt;a&lt;/td&gt;
&lt;td colspan="20" width="100"&gt;a&lt;/td&gt;
&lt;td colspan="20" width="100"&gt;a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="15" width="75"&gt;a&lt;/td&gt;
&lt;td colspan="15" width="75"&gt;a&lt;/td&gt;
&lt;td colspan="15" width="75"&gt;a&lt;/td&gt;
&lt;td colspan="15" width="75"&gt;a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="12" width="60"&gt;a&lt;/td&gt;
&lt;td colspan="12" width="60"&gt;a&lt;/td&gt;
&lt;td colspan="12" width="60"&gt;a&lt;/td&gt;
&lt;td colspan="12" width="60"&gt;a&lt;/td&gt;
&lt;td colspan="12" width="60"&gt;a&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
Copy linkTweet thisAlerts:
@ray326Mar 09.2006 — In fact you can't do what you want in the way you're attempting. This is the way colspan works.
[code=html]
<table>
<tr><td colspan="5">abcde</td></tr>
<tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td></tr>
</table>
[/code]
Copy linkTweet thisAlerts:
@waffleauthorMar 09.2006 — So I have to use css to do what I want?
Copy linkTweet thisAlerts:
@welshMar 09.2006 — it would be the right way to do it and probally be easier than tables.
×

Success!

Help @waffle spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...