2012-06-26 18 views
2

聽起來很容易,我知道。我告訴客戶,將在5分鐘內完成... 4小時後,它是剛開討厭...有人可以幫我限制CSS類的高度並添加一個滾動條嗎?

這是當前結構:

<div class="RadWindow"> 
    <table class="rwTable"> 
     <tr class="rwContentRow"> 
      <td class="helpDialog"> Content to be cut off and wrapped</td> 
     </tr> 
    </table> 
</div> 

實際上有幾個款式等在div中,但這些是我應該能夠控制它的方式。我曾嘗試在類.helpDialog上設置高度,最大高度和溢出,但沒有任何反應。

然後我試了一下在<td>

td.helpDialog 

我又試圖以詳細地規定整個路徑:

.RadWindow table td.helpDialog 

它只是不適合我的工作。任何幫助將不勝感激!

+0

我想你將不得不在'td'內添加'div'並將樣式應用於此。或者也許看看這裏:[如何隱藏錶行溢出?](http://stackoverflow.com/questions/1554928/how-to-hide-table-row-overflow) – steveax

回答

3

使用額外的div容器來控制佈局。

HTML:

<div class="RadWindow"> 
    <table class="rwTable"> 
     <tr class="rwContentRow"> 
      <td><div class="helpDialog">Content to be cut off and wrapped</div></td> 
     </tr> 
    </table> 
</div> 

CSS:

.helpDialog{ 
    height: 50px; 
    width: 50px; 
    overflow: hidden; 
} 

順便說一句,不超過限定的CSS選擇器。這會減慢您的頁面渲染,特別是在大型dom樹和/或動態網站上。

+0

感謝隊友。我會試試這個,希望能解決它。希望我能夠改變它(它由Telerik控件創建)... –

相關問題