从父表中的表中的最后一个单元格中删除border-left

时间:2014-05-21 16:45:36

标签: html css html5 css3

我有一个动态生成的日历,由表格组成,主表中的每个月都是一个单元格,在这个单元格中,还有另一个表格,其中包含每月每天的单元格。

我需要抓住整个桌子中的最后一天细胞并移除其左边界,而不是每个月的最后一天细胞,而是上个月的最后一天细胞。

是否可以单独执行此css?我尝试过使用last-child bit每个月的最后一天,这不是我需要的。

我在这里创建了一个演示,以明确我的意思:http://jsfiddle.net/9bXEp/

如果向右滚动,您将看到2014年8月和下面两行,最后一个单元格包含21和T.如果仔细观察并检查这些单元格,您会看到它左边有一个边框,导致与桌边的双边框。这就是我需要删除的东西,我不能直接应用一个类,因为在我的应用程序中,表是由php生成的。

这是代码,但jsfiddle将更清晰

     <table class="main_table years">
    <tbody>
        <tr>
            <td class="main_table" style="vertical-align:text-top;">Resources</td>
            <td class="main_table years months">July, 2014</td>
            <td class="main_table years months">August, 2014</td>
        </tr>
        <tr>
            <td class="main_table years"></td>
            <td class="inner_container">
                <table class="main_table table_inner">
                    <tbody>
                        <tr>
                            <td class="no-b">
                                <div class="cell_width">30</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">31</div>
                            </td>
                        </tr>
                        <tr>
                            <td class="no-b2">
                                <div class="cell_width">W</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
            <td class="inner_container">
                <table class="main_table table_inner">
                    <tbody>
                        <tr>
                            <td class="no-b">
                                <div class="cell_width">1</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">2</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">3</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">4</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">5</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">6</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">7</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">8</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">9</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">10</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">11</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">12</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">13</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">14</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">15</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">16</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">17</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">18</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">19</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">20</div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width">21</div>
                            </td>
                        </tr>
                        <tr>
                            <td class="no-b2">
                                <div class="cell_width">F</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">S</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">S</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">M</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">W</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">F</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">S</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">S</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">M</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">W</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">F</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">S</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">S</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">M</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">W</div>
                            </td>
                            <td class="no-b2">
                                <div class="cell_width">T</div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr id="7c0977ff-0ba1-2d74-b56d-52c4dff66cbd">
            <td class="cell_c link_c"><a href="index.php?module=Users&amp;action=DetailView&amp;record=7c0977ff-0ba1-2d74-b56d-52c4dff66cbd">guy</a>
            </td>
            <td colspan="2" class="no-b2">
                <table class="main_table table_inner" id="task0">
                    <tbody>
                        <tr>
                            <td class="no-b">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr id="1">
            <td class="cell_c link_c"><a href="index.php?module=Users&amp;action=DetailView&amp;record=1">Administrator</a>
            </td>
            <td colspan="2" class="no-b2">
                <table class="main_table table_inner" id="task1">
                    <tbody>
                        <tr>
                            <td class="no-b">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                            <td class="inner_td">
                                <div class="cell_width_chart day_block"></div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>

1 个答案:

答案 0 :(得分:0)

使用

.inner_container:last-child tr:last-child .no-b2:last-child {
    border-left: none;
}

选择最后一个.inner_container,然后选择最后一个tr(即数字行),然后选择最后一个.no-b2(即一天)。

哦,你确定它不是border-right吗?