2012-02-13 63 views
1

使用ckeditor用戶可以添加說明到他們的列表。一些描述的表格寬度比包含div更寬。我們如何強制描述適合包含div?子表重疊父div

<div style="float:left; padding-top: 4px; font-size:13px; width:500px; border-style:solid;">      
<table border="1" cellpadding="0" cellspacing="0" style="width:576px; height: 120px;">   
    <tr height="39">   
    <td height="39">     
     <p>     
     <span style="font-size:16px;"> 
      <span style="color: rgb(255, 140, 0);">APPLE FACTORY RECERTIFIED IPAD/1ST-GENERATION TABLET APPLE: 
      </span> 
     </span> 
     </p>    
     <p>     &nbsp; 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">A4/A4X1-1.00G 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">256MB/1-DIMM 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">16GB/FLASH 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">802.11A/B/G/N+BT INTEGRATED-GRAPHICS/0MB 9.7WXGA- 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">TOUCHSCREEN/MULTI-TOUCH APPLE/IOS-4.0 1.5LBS 1YR 
      </span> 
     </span> 
     </p>   </td>  
    </tr> 
</table> 
<p> &nbsp; 
</p>      
</span>    
</div> 

回答

1

你也可以在你的第一個div造型添加overflow: hidden;屬性是這樣的:

<div style="float:left; padding-top: 4px; font-size:13px; width:500px; border-style:solid; overflow: hidden;">      
<table border="1" cellpadding="0" cellspacing="0" style="width:576px; height: 120px;">   
    <tr height="39">   
    <td height="39">     
     <p>     
     <span style="font-size:16px;"> 
      <span style="color: rgb(255, 140, 0);">APPLE FACTORY RECERTIFIED IPAD/1ST-GENERATION TABLET APPLE: 
      </span> 
     </span> 
     </p>    
     <p>     &nbsp; 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">A4/A4X1-1.00G 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">256MB/1-DIMM 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">16GB/FLASH 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">802.11A/B/G/N+BT INTEGRATED-GRAPHICS/0MB 9.7WXGA- 
      </span> 
     </span> 
     </p>    
     <p>     
     <span style="font-size: 16px;"> 
      <span style="color: rgb(255, 140, 0);">TOUCHSCREEN/MULTI-TOUCH APPLE/IOS-4.0 1.5LBS 1YR 
      </span> 
     </span> 
     </p>   </td>  
    </tr> 
</table> 
<p> &nbsp; 
</p>      
</span>    
</div> 

這將減少重疊的文本,但它適合在父DIV。

+0

約翰,謝謝你的珍聞。你是否說溢出:隱藏是我能做的最好的?約翰h – complexi 2012-02-13 18:41:17

0

強制它只是給表的最大寬度屬性。您已將寬度屬性設置爲576px,它肯定比500px div大。

style="max-width:500px; height: 120px;"> 

迎接

+0

cyrillc,感謝珍聞,但表CSS是由用戶,而不是系統控制。使用任何CSS都無濟於事。約翰•H• – complexi 2012-02-13 18:43:21

+0

你可能想編寫一個腳本,然後,使用JS的用戶CSS後,將覆蓋臺最大寬度。 – CyrillC 2012-02-14 07:05:03