来自桌子的TD边框,未在IE8中显示

时间:2012-12-17 16:48:26

标签: css internet-explorer-8 html-table border

  

可能重复:
  CSS to make an empty cell’s border appear?

我知道此问题之前已被提出过很多问题,我尝试在每个<td> </td>标记之间添加&amp; nbsp并且效果不佳,我猜测CSS中存在某种问题但是我无法发现它,我的桌子显示好的Firefox和Chrome,但每当我尝试使用IE8时,都会丢失一些边框。下面是HTML和表格的CSS,以及截图。 表格的HTML是从PHP脚本生成的。

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <!--[if IE]>
        <link rel ="stylesheet" type ="text/css" href ="layout_ie.css"/> 
        <![endif]-->

        <!--[if !IE]> -->
        <link rel ="stylesheet" type ="text/css" href ="layout.css"/>
        <!-- <![endif]-->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
          <title>Calendario de Capacitaciones</title>
    </head>
    <body>

   <table  cellpadding="0" cellspacing="0" class="calendar">
        <tr class = "calendar-row"> 
            <td class = "calendar-day-head">Lunes</td>
            <td class = "calendar-day-head">Martes</td>
            <td class = "calendar-day-head">Miércoles</td>
            <td class = "calendar-day-head">Jueves</td>
            <td class = "calendar-day-head">Viernes</td>
            <td class = "calendar-day-head">Sábado</td>
            <td class = "calendar-day-head">Domingo</td>
        </tr>
        <tr class = "calendar-row">

            <td  class ="calendar-day-np">&nbsp; </td>
            <td  class ="calendar-day-np">&nbsp; </td>
            <td  class ="calendar-day-np">&nbsp; </td>
            <td  class ="calendar-day-np">&nbsp; </td>
            <td  class ="calendar-day-np">&nbsp; </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">1</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">2</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
        </tr>


        <tr class="calendar-row">
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">3</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">4</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">5</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">6</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">7</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">8</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">9</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
        </tr>

        <tr class="calendar-row">
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">10</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">11</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">12</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">
                &nbsp<div class = "day-number">13</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">14</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">15</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">16</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

        </tr>
        <tr class="calendar-row">
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">17</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">18</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">19</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp 
                <div class = "day-number">20</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">21</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">22</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">23</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
        </tr>

        <tr class="calendar-row">
            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">24</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">25</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">26</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">27</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">28</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">29</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>

            <td  bgcolor="#FFFFFB" class = "calendar-day">&nbsp
                <div class = "day-number">30</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
        </tr>
        <tr class="calendar-row">
            <td  bgcolor="#FFFFFB" class = "calendar-day">
                &nbsp<div class = "day-number">31</div><p>&nbsp;</p><p>&nbsp;</p>&nbsp
            </td>
            <td class = "calendar-day-np">&nbsp;</td>
            <td class = "calendar-day-np">&nbsp;</td>
            <td class = "calendar-day-np">&nbsp;</td>
            <td class = "calendar-day-np">&nbsp;</td>
            <td class = "calendar-day-np">&nbsp;</td>
            <td class = "calendar-day-np">&nbsp;</td>
        </tr>
    </table>        

    </body>
    </html>

CSS

    table.calendar    {table-layout:fixed;margin-top:5em ;margin-left:15em; border-left:1px solid #999; }
tr.calendar-row  {  }
td.calendar-day  { min-height:80px; font-size:11px; position:relative;border:1px solid #999; } * html div.calendar-day { height:80px; }
td.calendar-day:hover  { background:#eceff5; }
td.calendar-day-np  {  background:#eee; min-height:80px; } * html div.calendar-day-np { height:80px; }
td.calendar-day-head { background:#ccc; font-weight:bold; text-align:center; width:135px; padding:5px; border-bottom:1px solid #999; border-top:1px solid #999; border-right:1px solid #999; }
div.day-number    { background:#999; padding:5px; color:#fff; font-weight:bold; float:right; margin:-5px -5px 0 0; width:20px; text-align:center; }
/* shared */
td.calendar-day, td.calendar-day-np {  max-width:50px;  padding:5px; border-bottom:1px solid #999; border-right:1px solid #999; }

截图:

在IE8中的外观。

http://i.stack.imgur.com/j7w6H.jpg

外观如何,(摘自Firefox)。

http://i.stack.imgur.com/T0xzI.png

1 个答案:

答案 0 :(得分:2)

尝试在CSS中执行此操作:

td.calendar-day {
min-height:80px; 
font-size:11px;
border:1px solid #999 !important;
}