PDA

View Full Version : Forcing cells to maintain a given width?


packyak
04-22-2009, 02:39 AM
Hi,

I'm currently working on a new site for a client and I've hit a brick wall.

I have set up the home page with a table that contains three columns in the centre and a header row and a footer row at the top and bottom.

The table is set to width=100% as it needs to stretch the page to fit any browser size but I want the right hand column and the left hand column to maintain a set width.

So if the browser window was to be reduced in size only the middle column of the home page would actually reduce in width altering its contents as necessary to fit.

The right column contains a virtual include to show a navigation .inc and the left column will show adverts so it is imperative these hold there width.

Any help would be grand!

Shaun

Old Pedant
04-22-2009, 03:44 AM
Nothing to do with ASP, you know.

Strictly an HTML/CSS question.

First of all, you can't *FORCE* a browser to make columns any given width. You can ASK it to make them a set width and--so long as the browser determines that it can do so and still make the <TABLE> fit in the alloted space--your request will likely be honored. But don't bet your life on it.

So did you *TRY* simply doing:

<table width="100%">
<tr>
<td width="120">...</td>
<td>...</td>
<td>...</td>
<td>...</td>
<td width="180">...</td>
</tr>

????

Though you'd be better off using styles:

<table style="width: 100%;">
<tr>
<td style="width: 120px;">...</td>
<td>...</td>
<td>...</td>
<td>...</td>
<td style="width: 180px;">...</td>
</tr>

packyak
04-22-2009, 11:51 AM
That did not solve the problem, thanks fior the help, ill re-post this in the correct forum.