Automatically fit table to browser window

-but only stretch the fisrt and last columns

Page 1 of 1

1 Replies - 17887 Views - Last Post: 04 April 2008 - 02:46 PM

#1 lost child   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 18
  • Joined: 01-March 08

Automatically fit table to browser window

Posted 04 April 2008 - 06:20 AM

Hi, guys.

I need to have a table with its width stretched to fit the browser window; HOWEVER, I want ONLY the leftmost and the rightmost [e.g. the first and the last] columns to automatically adjust their widths and NOT the columns in the middle; I want the columns in the middle to have fixed widths.
Iím aware of the max-width property in CSS, but it has poor browser support and doesn't work reliably, so Iím looking for an alternative approach. Can this be achieved with a CSS expression without affecting the performance too much? I'd like to avoid using JS for this, unless there's a peace of code simple enough for a beginner like me to understand and implement.
Please guide me.

Thank you in advance.

This post has been edited by lost child: 04 April 2008 - 06:21 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Automatically fit table to browser window

#2 ahmad_511   User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: Automatically fit table to browser window

Posted 04 April 2008 - 02:46 PM

first your table must be "100%" (percental)
now the cells on the right and the left columns must have an "auto" width.

create a column group for the table and assign the "auto" for the first and last columns
<col width="auto"/><col width="30px"/><col width="30px"/><col width="30px"/><col width="30px"/><col width="30px"/><col width="auto"/>

Tested on IE7 / IE8 Beta 8.0.6001.17184 / FF3 Beta 4
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1