开发者

Table with percentage width does resize appropriately in IE8

开发者 https://www.devze.com 2023-03-04 02:41 出处:网络
I have a table element contained in a div and the table is set a width of 100%. The div element is reduced in width whenever the browser width reduces.
  • I have a table element contained in a div and the table is set a width of 100%.
  • The div element is reduced in width whenever the browser width reduces.
  • In Chrome, Safari,开发者_Python百科 Firefox and IE7 when the div get resized, the table also is resized.
  • But in IE8, though, the table remains without being resized and overflows the container div

Following is the structure I am dealing with

    <div style="width:500px">
       <table cellpadding="0" cellspacing="0" border="0" width="100%">
          <tbody>
            <tr>
              <td valign="top">
                <div>My table column contents</div>
              </td>
              <td valign="top">
                <div>My table second column contents</div>
              </td>
            </tr>
          </tbody>
       </table>
    </div>


You have the table wrapped in a div with a defined width. Just define the width of the table too.

0

精彩评论

暂无评论...
验证码 换一张
取 消