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>
4

1 回答 1

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>
于 2013-10-09T13:55:54.550 回答