IE8 中的虚线边框渲染错误
我在 IE8 中遇到了另一个问题 - 滚动页面时虚线边框会乱序和中断。
下面是 2 个 w3 有效页面,演示了该行为:作为 HTML4 过渡和 XHTML1 过渡。
在第一个示例中,我通过添加 发现了一个完全奇怪的解决问题的方法。元素。只要它在那里,边框就会保持完整(请参阅编辑)。
HTML4 Transitional:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>VALID HTML4 TR</TITLE>
<STYLE type="text/css">
#box {
float: left;
width: 200px;
height: 2000px;
border-right: dashed 1px black;
}
</STYLE>
</HEAD>
<BODY>
<DIV id="box"></DIV>
<INPUT><!-- REMOVE TO BREAK THE DASHED LINE ON SCROLL -->
</BODY>
</HTML>
XHTML1 Transitional:
这里的 魔法不会施放。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>VALID XHTML1 TR</title>
<style type="text/css">
#box {
float: left;
width: 200px;
height: 2000px;
border-right: dashed 1px black;
}
</style>
</head>
<body>
<div id="box"></div>
</body>
</html>
因此,
我需要的是第二个示例,其工作方式与第一个示例相同,而无需更改 DTD。
编辑:
<输入> magic for HTML4 示例并不适合所有人,即使使用相同的 IE8 版本也是如此。
点样式也有同样的问题。
如果 border-width > 则边框不会破裂1 像素。
I've come across yet another problem in IE8 - dashed borders scramble and break when scrolling the page.
Below are 2 w3-valid pages demonstrating the behavior: as HTML4 transitional and XHTML1 transitional.
In the 1st example I've discovered an utterly weird fix for the problem by adding an <input> element. Whenever it's there, the borders remain in one piece (see Edit).
HTML4 Transitional:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>VALID HTML4 TR</TITLE>
<STYLE type="text/css">
#box {
float: left;
width: 200px;
height: 2000px;
border-right: dashed 1px black;
}
</STYLE>
</HEAD>
<BODY>
<DIV id="box"></DIV>
<INPUT><!-- REMOVE TO BREAK THE DASHED LINE ON SCROLL -->
</BODY>
</HTML>
XHTML1 Transitional:
Here the <input /> magic does not cast.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>VALID XHTML1 TR</title>
<style type="text/css">
#box {
float: left;
width: 200px;
height: 2000px;
border-right: dashed 1px black;
}
</style>
</head>
<body>
<div id="box"></div>
</body>
</html>
Thus,
What I need is the 2nd example to work the same as the 1st without changing the DTD.
Edit:
The <input> magic for HTML4 example does not work for everyone, even when using the same IE8 build.
Same problem for dotted style.
Borders don't break if border-width > 1px.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您不应该使用黑客来弥补浏览器的不良行为。
最好接受不同浏览器的内容和样式有所不同,并且不值得尝试在每个浏览器中看起来完全相同。
实线有用吗?您可以为 IE 创建一个 CSS 文件,使用稍微不同的样式。
I don't think you should use hacks to compensate for bad browser behavior.
It's better to accept that your content and styling is different across browsers and it's not worth trying to look everything the exact same in every browser.
Does a solid line work though? You could make a CSS file for IE only that uses slightly different styling.