2013-10-14 46 views
0

我有一張桌子。有些TD有palin文本,有些TD有div文本。如何在任何html控件或沒有任何html控件的文本中應用css

<table class="k-selectable" role="grid" data-role="selectable"> 
    <tbody> 
     <tr class="k-state-selected" role="row" aria-selected="true"> 
      <td class="center" role="gridcell"> 
      </td> 
      <td class="center" role="gridcell"> 
       <div class="rc-sprite-td sprite-null"> 
        &nbsp;</div> 
      </td> 
      <td role="gridcell"> 
       <div class="wb-ro-changed"> 
        24261&nbsp;<span><img src="/RepairCenterWeb/Whiteboard/GetImage?IsOnHold=false&amp;IsVoid=false"></span></div> 
      </td> 
      <td role="gridcell"> 
       Issue 11 
      </td> 
      <td class="money" role="gridcell"> 
       <span class="float-left rc-sprite-td sprite-null">&nbsp;</span>$1,186.55 
      </td> 
      <td role="gridcell"> 
       <div class="wb-arrival-overdue"> 
        10/9/2013</div> 
      </td> 
      <td role="gridcell"> 
       <div class="wb-delivery-overdue"> 
        10/9/2013</div> 
      </td> 
      <td role="gridcell"> 
      </td> 
      <td role="gridcell"> 
      </td> 
      <td class="center" role="gridcell"> 
       <div class="rc-sprite-td sprite-null"> 
        &nbsp;</div> 
      </td> 
      <td class="center" role="gridcell"> 
       <img src="/RepairCenterWeb/Whiteboard/GetImage?IsClosed=false&amp;HasPpi=false&amp;IsPpiVeto=false&amp;IsPartsDeleted=false&amp;HasPartsSupplement=false&amp;HasLaborSupplement=false"> 
      </td> 
      <td class="center" role="gridcell"> 
       <img src="/RepairCenterWeb/Whiteboard/GetImage?HasSublet=false&amp;SubletStatus=0&amp;HasCriticalNote=false"> 
      </td> 
      <td class="center" role="gridcell"> 
       <div class="rc-sprite-td sprite-null"> 
        &nbsp;</div> 
      </td> 
      <td role="gridcell"> 
       <div class="center no"> 
        No</div> 
      </td> 
      <td role="gridcell"> 
       <div class="center "> 
       </div> 
      </td> 
      <td role="gridcell"> 
       <div class="center "> 
       </div> 
      </td> 
      <td role="gridcell"> 
       <div class="center no"> 
        No</div> 
      </td> 
      <td role="gridcell"> 
       <div class="center "> 
       </div> 
      </td> 
      <td role="gridcell"> 
       s s 
      </td> 
     </tr> 
    </tbody> 
</table> 

和CSS是

.k-state-selected:hover { 
    color: #ffffff; 
    background-color: #0992eb; 
    border-color: #0992eb; 
} 
.k-state-selected td div{color: #ffffff;} 

當我選擇它顯示的藍色背景和白色文本的任何行。我的問題是,它在div文本內部和內部的純文本中工作正常。任何一個都可以跨度內添加文本,標籤等,所以在這種情況下,我必須添加以下

.k-state-selected td label{color: #ffffff;} 
.k-state-selected td span{color: #ffffff;} 

是否有可以應用CSS對於TD中HTML控件內部測試的任何方式。

回答

2

您可以使用「任何元素」選擇*

.k-state-selected td * {color: #ffffff;} 

這隻會如果td有(至少)一個元素作爲子匹配。

相關問題