473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

how to: a dynamic td width between static td widths?

23s
Given the following table structure,

<table width=100%>
<tr>
<td>static</td>
<td>static</td>
<td>variable</td>
<td>static</td>
</tr>
</table>

I want opinions on how you'd assign width values to meet the following
criteria:

The first 2 cells of the table, as well as the last cell, need to maintain a
static width of [somevalue]... let's say 200px. The content within these
"static width" cells is guaranteed to never exceed, nor reach, 200px.

The 3rd cell containing the text 'variable' needs to span whatever space
remains between the first 2 and last cell of the table. So given the
table's overall width is "100%", spanning a horizontal vieable area of
850px, in this case the variable cell would need to end up at 250px, or
about 29%.

The way I accomplish this currently is through a brute-force implementation
of a 1x1 pixel of binary transparency streatched to 1 x 200 and inserted
just after the text in the cell, and then instructing the 3rd cell to have
a greater width than I know will ever be possible. So I end up with these
"opposing forces" pushing against each other, filling out the space as
intended:

<table width=100%>
<tr>
<td>static<br><img src=spacer.gif width=200 height=1></td>
<td>static<br><img src=spacer.gif width=200 height=1></td>
<td width=100%>variable</td>
<td>static<br><img src=spacer.gif width=200 height=1></td>
</tr>
</table>

Unfortuantely... and I think it's ie 5 for mac (can't remember) but one of
my clients can see those transparent gifs, and while it's not a total deal
breaker it's a bit of a turn-off for me. So I'd like to get rid of the
gifs, if I can. What other methods can I implement to accomplish this goal?
Jul 23 '05 #1
2 18187
23s wrote:
Given the following table structure,

<table width=100%>
<tr>
<td>static</td>
<td>static</td>
<td>variable</td>
<td>static</td>
</tr>
</table>

I want opinions on how you'd assign width values to meet the following
criteria:

The first 2 cells of the table, as well as the last cell, need to maintain
a
static width of [somevalue]... let's say 200px. The content within these
"static width" cells is guaranteed to never exceed, nor reach, 200px.

The 3rd cell containing the text 'variable' needs to span whatever space
remains between the first 2 and last cell of the table. So given the
table's overall width is "100%", spanning a horizontal vieable area of
850px, in this case the variable cell would need to end up at 250px, or
about 29%.

The way I accomplish this currently is through a brute-force
implementation of a 1x1 pixel of binary transparency streatched to 1 x 200
and inserted
just after the text in the cell, and then instructing the 3rd cell to
have
a greater width than I know will ever be possible. So I end up with these
"opposing forces" pushing against each other, filling out the space as
intended:

<table width=100%>
<tr>
<td>static<br><img src=spacer.gif width=200 height=1></td>
<td>static<br><img src=spacer.gif width=200 height=1></td>
<td width=100%>variable</td>
<td>static<br><img src=spacer.gif width=200 height=1></td>
</tr>
</table>

Unfortuantely... and I think it's ie 5 for mac (can't remember) but one of
my clients can see those transparent gifs, and while it's not a total deal
breaker it's a bit of a turn-off for me. So I'd like to get rid of the
gifs, if I can. What other methods can I implement to accomplish this
goal?


try this

<table style='width:100%'>
Â*Â*Â*Â*<tr>
Â*Â*Â*Â*Â*Â*Â*Â*<td style='width:200px"></td>
Â*Â*Â*Â*Â*Â*Â*Â*<td style='width:200px"></td>
Â*Â*Â*Â*Â*Â*Â*Â*<td></td>
Â*Â*Â*Â*Â*Â*Â*Â*<td style='width:200px"></td>
Â*Â*Â*Â*</tr>
</table>

Jul 23 '05 #2
23s

"vegas_t" <ve*****@att.net> wrote in message
news:Oh********************@bgtnsc05-news.ops.worldnet.att.net...
try this

<table style='width:100%'>
<tr>
<td style='width:200px"></td>
<td style='width:200px"></td>
<td></td>
<td style='width:200px"></td>
</tr>
</table>


This accomplishes the task cleanly if the table width is large enough to
accomodate the 3 static cells; i.e. the vieable area of the browser is at
least 600px wide, and the table is allowed to span at least that much
horizontal distance.

In a scenario where the overall table width is less than 600px, the "static"
cells will begin to compromise their 200px style and collapse... I guess
because table width overrides cell width in some hierarchy of layout logic
(IE 6).

If that's the case, then ultimately I would need one of 2 theoretical
properties for the table. Either a table width value of "100%, minimum
600px", or, a property that would indicate "cell width is to take priority
over table width, but only in the event table width threatens to compromise
cell width". Unfortuantely I've never heard of either of those things.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alex Shi | last post by:
In php, is there a way obtain the width of a charactor of a certain font? Alex -- ================================================== Cell Phone Batteries at 30-50%+ off retail prices!...
6
by: Michael Rozdoba | last post by:
I've tried to apply something along the lines of http://www.spartanicus.utvinternet.ie/test/caption_sized_to_image.htm to a floated span containing an image & caption, but I can't find anything...
4
by: N. Demos | last post by:
The following code renders as intended in IE (A TABLE, with cells of fixed width and height, inside of a DIV with fixed width and height and overflow set to hidden.) In Firefox, the table cells...
9
by: WeshaTheLeopard | last post by:
Hi all, I have to admit that I'm completely at loss trying to implement the following layout: +-----------document---------+ | | | +--box1---+ +--box2---+ |...
1
by: NullBock | last post by:
Hi, I'm trying to create a form with a text-input (not textarea) that expands to the size available, using CSS. I thought that a simple display:block would work: <form> <div> <input...
9
by: web1110 | last post by:
Hi y'all, I have resized the columns in a DataGrid and I want to set the width of the DataGrid to fit the columns. Just summing the column widths is too short due to the grid and gray row...
18
by: chimalus | last post by:
I am using a table with no column widths specified, letting the table layout manager do its thing for figuring out the column widths, and this works just fine. Now I want to make the table...
2
by: taras.di | last post by:
Hi everyone, I've been reading up on how to create a drop down box who's context is dynamically produced based on the value of a previous select box. I've read a lot about some of the browsers...
1
by: savajx1 | last post by:
I need to dynamically create a set of bound fields contained in a GridView control. I also have a single static CommandField that I can declare in the Columns <tagof the GridView control. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.