Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys im having problem with IE width 100%, I'm trying to create a table within a div tag with a width of 100%. now the problem is the width of the table is getting its 100% with on the browser and not on the parent... here is my html structure

<html>
  <body>
    <div id="test">
      <div id="inner_test">
         <table>
           <tr>
               <td>A value</td>
               <td>A value</td>
               <td>A value</td>
               <td>A value</td>
               <td>A value</td>
               <td>A value</td>
           </tr>
         </table>
      </div>
    </div>
  </body>
</html>


and inside the css file its this

#test{
  background-color: #ccc;
}
#inner_test{
 margin-left: 20px;
 margin-right: 20px;
}
#inner_test table{
 width: 100%;
}


so i was expecting that the table will fit the container "inner_test" but it seems that it gets its width on the parent of its parent which is the test

what im trying to achieve here is having a table with width of 100% even if they zoom out... by the way div test is a div tag located on the right side of my browser... you see i have a left div tag that is position on the left side... im trying to create a 2 column layout and my test div is the div on the right with a dynamic width...
Posted

1 solution

I tried it, compared Mozilla (SeeMonkey), Chrome and IE. IE sucks! However, it basically worked; I observed a different problem: your background color did not cover all the table on extreme zoom with IE, but it looked fine in other browsers.

If fixed it by setting the background for the table style instead. A background for td can also be helpful.

—SA
 
Share this answer
 
v5
Comments
Madzmar25 8-Feb-12 2:39am    
i see that should fix it... thanks again...
Sergey Alexandrovich Kryukov 8-Feb-12 3:09am    
Great. You are welcome.

Good luck, call again.
--SA
Espen Harlinn 8-Feb-12 9:18am    
5'ed!
Sergey Alexandrovich Kryukov 8-Feb-12 10:39am    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900