/    Sign up×
Community /Pin to ProfileBookmark

Easy table question

hiall ? i got this stupid problem, i hope it can be solved :S

<TABLE BORDER=3 VALIGN=top>
<TR>
<TD ROWSPAN=2 width=50>
This cell is the one that determines the height of
the whole table!
</TD>
<TD width=200>I dont want this cell to stretch</TD>
<tr>
<td>but i want this one to..</td>
</TABLE>

when using rowspan it tends to stretch all cells, even if one
has ha defined height and the other one doesnt it will eventually
stretch both ?

thx in advance, banan ?

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@LeeUMay 17.2004 — First of all, your coding is a little bit confused. Try the order below.

<table border="3" valign="top">

<tr>

<td rowspan="2" width="50">

This cell is the one that determines the height of

the whole table!

</td>

<td width="200">I dont want this cell to stretch</td>

<td>but i want this one to..</td>

</tr>

</table>

Secondly, I am not sure what you mean by "stretch". The one you don't want to stretch is 200 wide and the one you want ot stretch has no width listed.

Lee
Copy linkTweet thisAlerts:
@bananauthorMay 17.2004 — thx, but its supposed to be two levels like this:

____
| |_|

|_
|_|

sorry, ill try to explain better; i meant stretching the height.

right now if the cell wich has rowspan=2 gets larger

the table will look like this:

___
| | |

| |_|

| | |

|_
|_|

ie, both of the small cells are "stretched" vertically, but i only want one of them to, like this:

___
| |_|

| | |

| | |

|_
|_|

hope this clarifies :S
Copy linkTweet thisAlerts:
@LeeUMay 17.2004 — Why not just put another table within the existing one with the dimensions you need?
Copy linkTweet thisAlerts:
@dr_johnMay 17.2004 — [i]Originally posted by banan [/i]

[B]thx, but its supposed to be two levels like this:

____

| |_|

|_
|_|



sorry, ill try to explain better; i meant stretching the height.

right now if the cell wich has rowspan=2 gets larger

the table will look like this:

___

| | |

| |_|

| | |

|_
|_|



ie, both of the small cells are "stretched" vertically, but i only want one of them to, like this:

___

| |_|

| | |

| | |

|_
|_|



hope this clarifies :S [/B]
[/QUOTE]


I think that if you count them really carefully, you'll discover there are two rows in your illustration, and only one in your code...


So make a table 2 x 2. Merge/span vertically to get on long column on the left. Then start putting stuff in your cells.


Hint <tr> = row, <td> = a cell in a row. Think about colspan perhaps, not rowspan.
Copy linkTweet thisAlerts:
@bananauthorMay 18.2004 — uh, is it??

anyway, leeU is right ? how stupid of me, it works fine now, thx ?
Copy linkTweet thisAlerts:
@ronaldb66May 19.2004 — leeU is right [/QUOTE]
No, he's not. Nesting tables is bad practice and should be avoided if better alternatives are available.

You haven't been totally clear on the desired table layout, but I'm sure it can fairly easily be achieved.

A basic, two-row table with three cells, one spanning both rows:
[CODE]<table>
<tr>
<td rowspan="2">a</td>
<td>b</td>
</tr>
<tr>
<td>c</td>
</tr>
</table>[/CODE]

Remember: cell "a" is actually part of the first row, but since it spans both rows, the second row only contains one cell.
Copy linkTweet thisAlerts:
@bananauthorMay 19.2004 — [i]Originally posted by ronaldb66 [/i]

You haven't been totally clear on the desired table layout, but I'm sure it can fairly easily be achieved.[/QUOTE]


I'm sorry, my english isn't as good as i wish it was.

Your code doesn't differ from mine though, the whole thing is that

if cell A gets higher (if it's filled with some content) then

of course the whole table will be/get higher.

Cell A will be "stretched" and cell B and C will be stretched

to 50% each of the total height, right?

BUT, i only want ONE of the cells (B or C) to stretch together with cell A. So; cell A will (obviously) stretch 100%, cell B will be as high as it used to be and cell C will be X % (remaining hight of the entire table; that is of course: 100% -B's %).

Hope this makes is easier to understand. Thanks ?
×

Success!

Help @banan 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...