在 Firefox 中静态标头覆盖正文,在 IE 中不是静态的
告诉它保持静态的 CSS
#fruko {
position: fixed;
}
#links {
position: fixed;
}
Div 标签所在的 HTML
<td width="225px"><div id="fruko"><p><a href="#top" style="text-decoration: none"><font color="Red" size="8">Fruko, inc.</font></a></p></div></td>
<td><div id="links"><table border="5" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td align="center"><a href="#apps" style="text-decoration: none"><font size="6" color="Red">Apps</font></a></td>
<td align="center"><a href="#programs" style="text-decoration: none"><font size="6" color="Red">Programs</font></a></td>
<td align="center"><a href="#webs" style="text-decoration: none"><font size="6" color="Red">Websites</font></a></td>
<td align="center"><a href="#news" style="text-decoration: none"><font size="6" color="Red">News</font></a></td>
<td align="center"><a href="#social" style="text-decoration: none"><font size="6" color="Red">Social</font></a></td>
<td align="center"><a href="#about" style="text-decoration: none"><font size="6" color="Red">About</font></a></td>
</tr>
</table>
</div></td>
顶部主表格旁边的表格在 Firefox 中不会拉伸,但在 IE 中会拉伸。
此处亲自测试一下。
The CSS that tells it to stay static
#fruko {
position: fixed;
}
#links {
position: fixed;
}
The HTML where the Div tags are
<td width="225px"><div id="fruko"><p><a href="#top" style="text-decoration: none"><font color="Red" size="8">Fruko, inc.</font></a></p></div></td>
<td><div id="links"><table border="5" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td align="center"><a href="#apps" style="text-decoration: none"><font size="6" color="Red">Apps</font></a></td>
<td align="center"><a href="#programs" style="text-decoration: none"><font size="6" color="Red">Programs</font></a></td>
<td align="center"><a href="#webs" style="text-decoration: none"><font size="6" color="Red">Websites</font></a></td>
<td align="center"><a href="#news" style="text-decoration: none"><font size="6" color="Red">News</font></a></td>
<td align="center"><a href="#social" style="text-decoration: none"><font size="6" color="Red">Social</font></a></td>
<td align="center"><a href="#about" style="text-decoration: none"><font size="6" color="Red">About</font></a></td>
</tr>
</table>
</div></td>
Also the table in side the main table at the top doesn't stretch in Firefox but it does in IE.
Test it for yourself here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Internet Explorer 条件注释来加载专门为 IE 定制的样式。
http://msdn.microsoft.com/en- us/library/ms537512(v=vs.85).aspx
这并不能解决问题的根源,因为人们应该普遍使用跨浏览器CSS,但它确实有效地满足了这样的需求就像这个。
You could use Internet Explorer conditional comments to load styles specifically tailored to IE.
http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx
This would not solve the root of the problem in that one should use generally cross-browser CSS, but it does efficiently meet needs such as this one.
你的措辞有点混乱。您说的是“static”标头,这是一个有效的 css 位置,例如
position:static
,但您声明的是position:fixed
,它具有完全不同的效果,值得这样做如果您不清楚,请研究差异。向元素添加
position:fixed
可以有效地将其从元素流中取出,并使其相对于浏览器窗口“固定”。它下面的所有元素都会向上移动,就像它不存在一样。您遇到的任何 IE 问题都可能与整个页面是用表格构建的这一事实有关,这些表格可能会出现问题并且在浏览器之间不一致。此外,旧版本的 IE 不支持
position:fixed
Your wording is a little confusing. You are saying 'static' header, which is a valid css position e.g.
position:static
, but you are declaringposition:fixed
which has a completely different effect and it's worth doing research into the difference if you're unclear.Adding
position:fixed
to an element effectively takes it out of the flow of elements and makes it 'fixed' relative to the browser window. All the elements below it will shift up like it's not even there.Any IE problems you have are probably related to the fact the the whole page is built with tables which can be problematic and inconsistent between browsers. Also, older versions of IE don't do
position:fixed