 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
msing
Joined: 21 Nov 2006 Posts: 2
|
Posted: Tue Nov 21, 2006 3:59 pm Need one <td> to stay right |
|
|
|
That probably wasn't the best title for this post, but here's what I'm trying to do...
Wow just as I started typing this message I had a revelation and figured it out, but I figure the info might help someone else.
What I was trying to do was have a one-row table with two columns (<td>s). I wanted the <td> on the left to be left aligned and cover as much of the row as possible, while the <td> on the right stayed right justified and stayed as small as possible while still keeping its form (i.e. no crazy word wrap).
I didn't want to use specific width percentages, but then I realized that if you give a <td> too little of a percentage, it still exists wholly, and isn't taken over by the other <td> with too much percentage.
So what I did was give the <td> on the left a width of 100%, the <td> on the right a width of 0% (although I imagine any percentages that jipped the right <td> would have worked), and then I set NOSPAN on the right <td>.
So when you smoosh and stretch the page, the <td> on the right stays right-aligned in the row and doesn't expand or contract, and the <td> on the left stays left-aligned and simply expands and contracts as nessecary.
Nifty! |
|
joahop
Joined: 11 Dec 2006 Posts: 1
|
Posted: Mon Dec 11, 2006 4:48 pm Does not solve my problem! |
|
|
|
That helped partially for me. I have a table with three rows, where I want to put a picture to the left on the first row, to the right on the second and only text on the third row.
Hence, I made a three-column table, using colspan=2 to avoid unwanted text wrapping.
Unfortunately for me, the text on the first row wraps with the picture on the second row, while the text on the second row turns out the way I want it to.
I can easily re-write the code so that the text wraps in the middle column on the two first rows. I then use colspan=2 to put the text on the second row and it looks just like I want it to.
But now, if I continue by trying to span the first row text over two columns, the text wraps over the second row picture. Aargh!
Here's my code:
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td width=20> </td>
<td valign=top><img src="ExallonRoster_files/mts_stor.gif"></td>
<td colspan=2 width=100%><p>First row text</p></td>
<td width=20> </td>
</tr>
<tr><td width=20> </td><td colspan=3><hr color=18529c></td><td width=20> </td></tr>
<tr>
<td width=20> </td>
<td colspan=2 width=100%><p>Second row text</p></td>
<td valign=top><img src="ExallonRoster_files/jmn_stor.gif"></td>
<td width=20> </td>
</tr>
<tr><td width=20> </td><td colspan=3><hr color=18529c></td><td width=20> </td></tr>
<tr>
<td width=20> </td>
<td colspan=3><p>Third row text, no pictures</p></td>
<td width=20> </td>
</tr>
</table>
Next day:
I sorted it out on my own. What I had to do is that I added one row with the only purpose to define the widths of each column.
<tr>
<td width=20> </td>
<td width=140> </td>
<td width=100%> </td>
<td width=140> </td>
<td width=20> </td>
</tr>
So now that might help someone with the same table issue.  |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8428 Location: Castle Pines North, CO USA
|
Posted: Tue Dec 12, 2006 5:14 am Re: Need one <td> to stay right |
|
|
|
| msing wrote: |
So what I did was give the <td> on the left a width of 100%, the <td> on the right a width of 0% (although I imagine any percentages that jipped the right <td> would have worked), and then I set NOSPAN on the right <td>.
So when you smoosh and stretch the page, the <td> on the right stays right-aligned in the row and doesn't expand or contract, and the <td> on the left stays left-aligned and simply expands and contracts as nessecary.
Nifty! |
Your source code would help a lot more actually to show others.
_________________
Corey
Toll Fax Numbers | Merchant Accounts |
|
horsie_gurl
Joined: 10 Sep 2008 Posts: 1
|
Posted: Wed Sep 10, 2008 1:11 pm similar question |
|
|
|
Okay. I have a three column table with many many rows. Thats where my problem is different. I'm trying to avoid aligning each cell because i may have to add more rows in the future. (Its for a list of people with certain information for each to the right).
I want to align the first column to the left and the next two to the center.
I used the code
<COL ALIGN=CENTER SPAN=3>
to get all three columns aligned.
is there a way i can get it to just span the last two columns without changing the code throughout the table? |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|