tags:

views:

156

answers:

4

Hello All, I have the following html code.

<html>
<body>
   <div style="max-width:1600px; min-width:900px;" >
     <table>
     </table>
   </div>
</body>
</html>

My question , when I have the screen resolution to 1024 * 768 then the table should fit the screen and when I increase the screen resolution to 1600 * 800 the table size should automatically increase its width. How do I do that ?

Regards, Mithun

+3  A: 

Hi,

Try to give width:100%; to the table inside the div, that should do the trick.

yoda
No not sure if you got my question. I have a table with 8 columns (I have not specified length for the <td> ). when the screen resolution is 1024*768 then the table should fit the screen,if it means some <td> should have multiple lines of data. But if I make the screen resolution at 1600 * 800 then those <td> which had multiple lines should try to accomodate more data. At present if i give width:100% I get a horizonta scrollbar in the 1024*768 case (I want the <td> to display the data in mutltiple lines)
mithunmo
What you want is only accomplishable by using divs, not a table.
yoda
A: 

In no case can you get a scrollbar... you must be having the td in a div something because of which a scrollbar is coming

try

width:100%;display:block;

or else paste the source of the table here... I will definitely help...

and there is not point Not declaring the td lengths... declare them equally...

Pushpinder
A: 

Did you try:

<body>
  <table style="width: 100%; margin: 0px; padding: 0px">
    ...
  </table>
</body>
MiffTheFox
A: 

<table style="table-layout:fixed;width:100%;"> should do the trick. The catch is, first row's cells widths will determine the corresponing columns' widths if you set. Otherwise it will be evenly distrbuted.

artificialidiot