我在为表中的元素创建类时遇到问题

时间:2013-10-09 13:51:28

标签: html css3

我在为表中的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 个答案:

答案 0 :(得分: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>