2015-01-27 67 views
2

这可能是一个“被废弃”的问题,但我有困难放置一个图像旁边的一个表已经居中下面的代码是我坚持使用的代码段。放置一个图像下一个居中的表

<img src="FS.png" class="abcdef" width="124" height="166" style="float:right;position: relative"/> 
 
      <div align="center"> 
 
        
 
       <table width="576" border="1"> 
 
       <tr> 
 
      <td width="348">&nbsp;</td> 
 
      <td width="212">&nbsp;</td> 
 

 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
      <tr> 
 
      
 
      <td>&nbsp;</td> 
 
      <td>&nbsp;</td> 
 
      </tr> 
 
     </table> 
 
     </div> 
 
     </div>

图像被放置在最右边的表在屏幕中央的和我需要的图像旁边被放置到桌子的中央。

+0

尝试浮子,然后重新调节元件的宽度。 – 2015-01-27 00:13:57

回答

2

div#tab{width:580px; float:left;} 
 
div#pix{width:150px; float:right;} 
 

 
body{width:730px; 
 
    margin:0 auto;}
<body> 
 
<div id="tab"> 
 

 
    <table width="576" border="1"> 
 
    <tr> 
 
     <td width="348">&nbsp;</td> 
 
     <td width="212">&nbsp;</td> 
 

 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 

 
     <td>&nbsp;</td> 
 
     <td>&nbsp;</td> 
 
    </tr> 
 
    </table> 
 
    </div> 
 
<div id="pix"> 
 
    <img src="FS.png" class="abcdef" width="124" height="166" float="right" position="relative"/> 
 
</div> 
 
    </body>

+0

谢谢你,我正在考虑这样做..但表格将填充由PHP希望不会影响其结构。 – 2015-01-27 00:40:21