To clarify what mms_master said...
max-width isn't supported by IE6, but is by IE7 and IE8.
Also JavaScript is only needed for that expression() to be used in IE.
Main Topics
Browse All TopicsI want to be able to adjust table width in HTML page depending on screen resolution, using the following logic:
if screen width >= 1024 then
set table.width to 1024
else
set table width to 100%
please provide code
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
@Kravimir
Even though IE7 is supposed to support max-width when I removed the expression() line and tested in IE7 the table still went over 1024px. So did I do something wrong?
@qwerty
The table width is set to 100% unless the browsers clientWidth is > 1024px. So it will increase or decrease with the resolution but have a max width of 1024.
Business Accounts
Answer for Membership
by: mms_masterPosted on 2009-04-30 at 02:02:33ID: 24267992
Hi,
I've attached an example web page below with a basic table that does what you have asked.
Instead of if screen width > 1024, I have used if browser window > 1024 because If the screen width is 1024 the browsers window will be slightly less. This would cause the table to be slightly too big and a scroll bar would be displayed at the bottom.
Note: This code requires the user to have javascript enabled.
Hope this helps,
mms_master
Select allOpen in new window