2013-10-09 66 views
0

我在爲表內的tr_item,id_cell,time_cell,name_cell創建css類時遇到問題。我在爲表內的元素創建類時遇到問題

     <table width="300px" colspan="4" class="info"> 
          <thead > 
           <tr colspan="4"> 
            <th class="id">ID</th> 
            <th class="time">Time</th> 
            <th class="name">Event</th> 
           </tr> 
          </thead> 
          <tbody colspan="4"> 
           <tr class="tr_item"> 
            <th class="id_cell">1234</th> 
            <th class="time_cell">11:22</th> 
            <th class="name_cell">ABC-DEF</th> 
           </tr> 

          </tbody> 
         </table> 
+1

你有什麼問題呢? 「colspan =」4「」不應該放在「th」或「td」上?我不認爲它在'tbody'或'tr'上做了什麼。 – Danny

+0

哦好吧...但我的問題是,即時通訊沒有管理鏈接類.id_cell,我在做:table tbody tr.id_cell:仍然沒有 –

+0

@JesperScerri你沒有任何'tr'元素你希望選擇器是'table tbody tr th.id_cell'或者只是th.id_cell。 th元素應該td btw – Schleis

回答

0

這你在找什麼呢?

http://jsfiddle.net/raghn/

.tr_item{ 
    background-color: red; 
} 

.tr_item th:first-child{ 
    background-color: blue; 
} 

<table width="300px" colspan="4" class="info"> 
          <thead > 
           <tr colspan="4"> 
            <th class="id">ID</th> 
            <th class="time">Time</th> 
            <th class="name">Event</th> 
           </tr> 
          </thead> 
          <tbody colspan="4"> 
           <tr class="tr_item"> 
            <th class="id_cell">1234</th> 
            <th class="time_cell">11:22</th> 
            <th class="name_cell">ABC-DEF</th> 
           </tr> 

          </tbody> 
         </table> 
+0

是啊,那是我正在試圖做的一個 –

+0

它的類沒用。它像班級甚至沒有創建。例如.tr_item甚至沒有工作。我要瘋了 –

+0

小提琴工作 - 你的代碼中有什麼不一樣? – juanvan

相關問題