简体   繁体   English

表格填充在IE中不起作用

[英]Table padding doesn't work in IE

i have a table that consists of two rows, the second row is a table, which i want it's elements to be centered to the main table, so my code is as follows: 我有一个由两行组成的表,第二行是一个表,我希望它的元素居中于主表,所以我的代码如下:

<TABLE>
  <TBODY>
    <TR>
     <TD>
      <DIV id=gform:scan_area>
        <OBJECT></OBJECT>
      </DIV>
    </TD>
  </TR>
  <TR>
   <TD>
    <TABLE style="PADDING-LEFT: 300px"> // works in firefox but doesn't work in ie9
     <TBODY>
      <TR>
       <TD>
         <INPUT>
       </TD>
       <TD>
         <SPAN></SPAN>
       </TD>
        <TD>
        <INPUT>
        </TD>
      </TR>
     </TBODY>
    </TABLE>
   </TD>
   </TR>
  </TBODY>
</TABLE> 

ISSUE: TABLE style="PADDING-LEFT: 300px" works fine in firefox but doesn't work in IE9 (Quirks mode) , please advise how to fix this issue or if you have any other ideas. 问题: TABLE style="PADDING-LEFT: 300px"在Firefox中工作正常,但在IE9(Quirks模式)下不起作用,请告知如何解决此问题或您有任何其他想法。

I think your code is not written well enough, it was much better if you used "colspan" for solving this issue. 我认为您的代码编写得不够好,如果您使用“ colspan”来解决此问题,那就更好了。 Any way, I tried to change your code in a way that centralize the second table in the first table: 无论如何,我试图通过将第二个表集中在第一个表中的方式来更改您的代码:

<TABLE>
  <TBODY>
    <TR>
     <TD>
      <DIV id='gform:scan_area'>
        <OBJECT></OBJECT>
      </DIV>
    </TD>
  </TR>
  <TR>
   <TD>
    <TABLE style="width:60%"> 
     <TBODY>
      <TR>
       <TD style="width:20%;padding-right:160px;">
         <INPUT>
       </TD>
       <TD style="width:20%">
         <SPAN></SPAN>
       </TD>
        <TD style="width:20%">
        <INPUT>
        </TD>
      </TR>
     </TBODY>
    </TABLE>
   </TD>
   </TR>
  </TBODY>
</TABLE> 

You need to do it this way 你需要这样

<div style="padding-left: 300px;">
    <table>
        ...
    </table>
</div>

For more read this answer: Padding table with CSS doesn't work on IE 有关更多信息,请参见以下答案: CSS填充表在IE上不起作用

Table padding is only applied to cells. 表填充仅适用于单元格。 By adding it to the <td> you will see it work in IE9 and Firefox. 通过将其添加到<td>您将看到它在IE9和Firefox中可以正常工作。 See: W3schools: Tables 参见: W3schools:桌子

<TABLE> // works in firefox but doesn't work in ie9
 <TBODY>
  <TR>
   <TD style="PADDING-LEFT: 300px">
     <INPUT>
   </TD>
   <TD >
     <SPAN></SPAN>
   </TD>
    <TD>
    <INPUT>
    </TD>
  </TR>
 </TBODY>
</TABLE>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM