2012-04-24 86 views
1

我一直在努力解决这个问题几个小时。我有一个表格行,它有三个锚点将图片作为按钮包裹起来。在大多数浏览器中,它可以,但在Firefox和IE中,表格行与“A”标签以及下一行表格之间存在差距。在Firefox中,这似乎是由锚定引起的,因为当我将锚定出来时,问题就消失了。在IE中,这个问题似乎有所不同,我还没有进一步隔离它。在这个阶段,如果有人有关于如何在Firefox中解决这个问题的线索,我将非常感激。下面是受影响的表行的代码段:表格间在表格行之间的差距

<tr class="topcontrols" height="55"> 
    <td class="topcontrols" style="width:13px;" height="55" width="13"> 
     <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/lt_frame_corner.gif" width="13" height="55" hspace="0" vspace="0" border="0"/> 
    </td> 
    <td style="width:56px;" height="55" width="56" class="frametop"> 
     <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/frame_top.gif" width="56" height="55" hspace="0" vspace="0" border="0"/> 
    </td> 
    <td class="topcontrols" style="width:160px;" width="160" height="55"> 
     <a class="topcontrols" class="topcontrols" href="<?php echo $this->baseurl ?>/index.php/novazeal"> 
      <?php if($this->countModules('novazeal-home')) { ?> 
       <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/button_home_active.gif" width="160" height="55" border="0" /> 
      <?php } else { ?> 
       <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/button_home_inactive.gif" width="160" height="55" border="0" /> 
      <?php } ?> 
     </a> 
    </td> 
    <td class="servicestab" height="55" width="163"> 
     <div class="servicesdropmenu"></div> 
     <a class="topcontrols" href="<?php echo $this->baseurl ?>/index.php/novazeal/services"> 
      <?php if($this->countModules('novazeal-services')) { ?> 
       <img class="servicestab" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/button_services_active.gif" width="163" height="55" border="0" /> 
      <?php } else { ?> 
       <img class="servicestab" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/button_services_inactive.gif" width="163" height="55" border="0" /> 
      <?php } ?> 
     </a> 
    </td> 
    <td class="topcontrols" style="width:161px;" height="55" width="161"> 
     <a class="topcontrols" href="<?php echo $this->baseurl ?>/index.php/novazeal/contact"> 
      <?php if($this->countModules('novazeal-contact')) { ?> 
       <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/button_contact_active.gif" width="161" height="55" border="0" /> 
      <?php } else { ?> 
       <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/button_contact_inactive.gif" width="161" height="55" border="0" /> 
      <?php } ?> 
     </a> 
    </td> 
    <td class="frametop" style="width:256px;" height="55" width="256"> 
     <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/frame_top.gif" width="256" height="55" border="0" style="width:256px"/> 
    </td> 
    <td class="topcontrols" style="width:14px;" height="55" width="14"> 
     <img class="topcontrols" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/rt_frame_corner.gif" width="14" height="55" border="0" /> 
    </td> 
</tr> 
<tr style="height:100%;"> 
    <td class="frameedges" bgcolor="#131243" style="background-image: url(<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/left_frame_edge.gif);"> 
    </td> 
    <td colspan="5" BGCOLOR="#ffffee" class="contentarea"> 
     <jdoc:include type="component" /> 
    </td> 
    <td class="frameedges" bgcolor="#131243" style="background-image: url(<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/right_frame_edge.gif);"> 
    </td> 
</tr> 

,这里是在这些行使用的CSS:

.contentarea { 
    background-color: #ffffff; 
    min-height:100%; 
    height:100%; 
    overflow:hidden; 
    position:relative; 
    vertical-align: top; 
} 

.frametop { 
    background:url(../images/frame_top.gif); 
    max-height:55px; 
    height:55px; 
    overflow:hidden; 

} 

.topcontrols { 
    position: relative; 
    max-height:55px; 
    height:55px; 
    overflow:hidden; 
} 

.servicestab { 
    position: relative; 
    max-height:55px; 
    height:55px; 
    overflow:hidden; 
    width:163px; 

} 

.servicesdropmenu { 
    -moz-transition: all 0.2s ease-in-out; 
    -webkit-transition: all 0.2s ease-in-out; 
    -o-transition: all 0.2s ease-in-out; 
    transition: all 0.2s ease-in-out; 
    background-color:rgba(100,100,255,0.0); 
    height:14px; 
    width:158px; 
    position:absolute; 
    z-index: 100; 
    top:38px; 
    left:3px; 
} 

.servicestab:hover .servicesdropmenu { 
    height:100px; 
    background-color:rgba(100,100,255,0.92); 
} 

感谢您的任何想法,可能会导致一个解决方案。

Terry Rozmus。

+1

请创建一个演示问题的小提琴。 – mingos 2012-04-24 10:49:28

+0

请过去只是HTML,并包括表部分.. – 2012-04-24 10:52:19

回答

1

使用表格布局是一种不好的做法。尝试使用div的CSS来代替。 它更好,一旦你掌握了它的方便和方式更容易配置。

  1. 表格通常是标记的更多字节。 (更长时间下载,并且主机的更多字节流量。)
  2. 表通常会阻止增量呈现。 (使用 用户需要更长时间才能看到页面上的任何内容。)
  3. 表格可能会要求您将单个逻辑图像切割成多个 。 (这使得重新设计总地狱,也增加了页面加载 时间[多个HTTP请求和更多的总字节数。)
  4. 表打破某些浏览器文本复制。(这是恼人的用户。)
  5. 表防止某些从他们的工作布局(如 身高:100%的子元素)。 (它们限制你可以在布局方面实际做的 。)
  6. 一旦你知道CSS,基于表格的布局通常需要更多的时间去实现 。 (稍微付出一些努力,前期学习CSS最终付出了很大努力 )。
  7. 表格在语义上是不正确的布局标记。 (他们描述的是 的演示文稿,而不是内容。)
  8. 表格让那些使用屏幕阅读器的人们感到难过。 (不仅 你CSS的其他好处,你也帮助了 盲/部分视力,这是一件好事。)
  9. 表上的锁,你到当前的设计,使重新设计MUCH 更难比语义HTML + CSS
+0

谢谢。我实际上在开始阅读你的回复之前已经开始将它转换为DIV,而且它似乎已经将问题排除了。我已经停止了一段时间的网站设计,而Tables是当时做布局的正常方式。 – 2012-04-24 13:45:29

+0

啊,很高兴听到它解决了! – Scriptor 2012-04-24 13:56:07