2011-10-03 73 views
3

我正在使用ie 8. 我有以下CSS我想要显示外部表的边框,但不是嵌套在其中一个单元格内的表;CSS - 嵌套的表格边框显示。我该如何阻止?

table#ScheduledLeaveCalendar 
{ 
table-layout:fixed; 
} 

/* Calendar that shows annual leave */ 
#ScheduledLeaveCalendar 
{ 
    border-collapse:collapse; 
} 
#ScheduledLeaveCalendar td, #ScheduledLeaveCalendar th 
{ 
    font-size:0.8em; 
    border:1px solid #2906A6; /* dark blue */ 

} 
#ScheduledLeaveCalendar th 
{ 
    width:30px; 
    font-size:0.9em; 
    text-align:center; 
    padding:5px 3px 4px 3px; 
    padding-top:5px; 
    padding-bottom:4px; 
    background-color:#6640EE; /* blue */ 
    color:#ffffff; 
} 
#ScheduledLeaveCalendar td 
{ 
    padding: 0px; 
    margin: 0px; 
} 

#ScheduledLeaveCalendar table 
{ 
    border-collapse: collapse; 
    border: 0px; 
    margin: 0px; 
    padding: 0px; 
} 

这个CSS给我 When splitting the cell in 2, the border becomes thicker

标记为;

<table id="ScheduledLeaveCalendar"> 

    <tr> 
     <th colspan="2"></th> 
     <th colspan="6">Oct 2011</th> 
     <th colspan="1"></th> 
    </tr> 
    <tr> 
      <th>F</th><th></th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th></th><th>M</th> 
    </tr> 
    <tr> 
    <th>14</th><th></th><th>17</th><th>18</th><th>19</th><th>20</th><th>21</th><th></th><th>24</th> 
    </tr> 
    <tr> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 
    <td><table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"><tr><td /> 
<td class="StandardCellHeight&#32;AnnualLeaveColour" /> 
</tr></table></td> 
    <td><table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"><tr><td class="StandardCellHeight&#32;AnnualLeaveColour" /> 
<td /> 
</tr></table></td> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 
    <td class="StandardCellHeight&#32;DefaultColour"></td> 

</tr> 

</table> 

http://jsfiddle.net/Dqm68/1/

+1

你可以做一个jsFiddle演示看起来像你的截图?我尝试过,但它不是很正确:http://jsfiddle.net/thirtydot/Dqm68/ – thirtydot

+0

我刚刚这样做。我是jsFiddle的新手,我应该开始使用它。 http://jsfiddle.net/Dqm68/1/ – arame3333

回答

3

只需添加另一条线从嵌套表TD删除边框。

#ScheduledLeaveCalendar table td {border:none} 

http://jsfiddle.net/blowsie/Dqm68/3/

+0

很多问题是缓存阻碍了解决方案的运行。这一个做了,我确信另一个也做到了! – arame3333

+0

使用Ctrl + F5或这个整齐的Firefox插件https://addons.mozilla.org/en-US/firefox/addon/css-reloader/:D – Blowsie

+0

我正在使用ctrl + F5,但我不知道FF reloader。谢谢你。 – arame3333

5

您可以使用

#ScheduledLeaveCalendar td td { 
    border: 0; 
} 

这意味着嵌套在其他td元素不应该有边界的td元素..

演示在http://jsfiddle.net/Dqm68/5/