Firefox和IE - Firefox处理<span>内部表(html和css)

1 html css firefox html-table

我很难让span标签在桌面内正常工作.看起来似乎忽略了在Firefox中的表标签之间的任何位置定义的整个span标记,但是在IE中它正确显示.

也许我错过了一些东西,但我创建了一个小例子CSS和html文件,在Firefox和IE中显示不同.希望有人可以告诉我它为什么会这样表现,或者我如何重新排列html来解决Firefox中的问题.

--- ---的main.css

.class1 A:link {color:#960033; text-decoration: none}
.class1 A:visited {color:#960033; text-decoration: none}
.class1 A:hover {color:#0000FF; font-weight: bold; text-decoration: none}
.class1 A:active {color:#0000FF; font-weight: bold; text-decoration: none}

.class2 A:link {color:#960033; text-decoration: none}
.class2 A:visited {color:#960033; text-decoration: none}
.class2 A:hover {color:#0000FF; text-decoration: none}
.class2 A:active {color:#0000FF; text-decoration: none}
Run Code Online (Sandbox Code Playgroud)

--- TEST.HTM ---

<HTML>
<HEAD>
<title>Title Page</title>
<style type="text/css">@import url("/css/main.css");</style>
</HEAD>

<span class="class1">
<BODY>

<table><tr><td>
---Insert Hyperlink---<br>
</td></tr>

</span><span class="class2">

<tr><td>
---Insert Hyperlink---<br>

</td></tr></table>

</span>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)

Pat*_*and 7

我很遗憾地说,但你的HTML很乱.IE浏览器大战中显示跨度的原因可能是浏览器大战的残余,当时Netscape和微软不断相互斗争,谁能理解最糟糕的HTML.允许内唯一的标签<table>-标签是<legend>,<colgroup>,<tbody>,<tfoot>,<thead><tr>.如果您希望<span>可见,请将其放在<td>里面<tr>

就像是:

<HTML>
<HEAD>
<title>Title Page</title>
<style type="text/css">@import url("/css/main.css");</style>
</HEAD>

<BODY>

<table>
  <tr>
    <td>
     ---Insert Hyperlink---<br>
    </td>
  </tr>

  <tr>
    <td>
      <span class="class2"></span>
       ---Insert Hyperlink---<br>
    </td>
  </tr>
</table>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)

另外,确定您是否要在标签中使用小写或大写字符.它使您更容易遵循您的代码.

  • +1"谁可以理解最糟糕的HTML" (3认同)