Firefox中的CSS对角线边框别名

Vla*_*mir 5 html css firefox border antialiasing

我通过使用CSS中的border属性绘制了一个形状.它在Chrome中看起来不错,但在Firefox中,边框非常难看:

.shape
{
	width: 100px;
	height: 50px;
	margin: 0 auto;
	background-color: #3F7296;
	position: relative;
	color: #FFF;
	line-height: 50px;
	font-size: 40px;
}
.b1, .b2
{
	position: absolute;
	left: 100px;
	bottom: 0px;
	width: 0px;
	height: 0px;
	border-style: solid;
	border-width: 0px 0px 50px 16px;
	border-color: transparent transparent transparent #3F7296;
}

.b2
{
	left: -16px;
	border-width: 50px 16px 0px 0px;
	border-color: transparent #3F7296 transparent transparent;
}
Run Code Online (Sandbox Code Playgroud)
<div class="shape">
	<i class="b1"></i>
	<i class="b2"></i>
</div>
Run Code Online (Sandbox Code Playgroud)

小提琴:http://jsfiddle.net/Ly1dz111/

Chrome的屏幕截图:

尼斯

Firefox(Mac OS X)的屏幕截图

丑陋

如何在Firefox中修复此问题?

Max*_*ter 5

这是Firefox处理对角线边框的一个已知错误,解决方法是在元素上设置缩放变换,以便Firefox通过额外的图形步骤强制运行它.

在你的榜样,该解决方案是设置-moz-transform: scale(.9999).b1.b2元素.这迫使Firefox中的抗锯齿.

.shape
{
	width: 100px;
	height: 50px;
	margin: 0 auto;
	background-color: #3F7296;
	position: relative;
	color: #FFF;
	line-height: 50px;
	font-size: 40px;
}
.b1, .b2
{
	position: absolute;
	left: 100px;
	bottom: 0px;
	width: 0px;
	height: 0px;
	border-style: solid;
	border-width: 0px 0px 50px 16px;
	border-color: transparent transparent transparent #3F7296;
	-moz-transform: scale(.9999)
}

.b2
{
	left: -16px;
	border-width: 50px 16px 0px 0px;
	border-color: transparent #3F7296 transparent transparent;
}
Run Code Online (Sandbox Code Playgroud)
<div class="shape">
	<i class="b1"></i>
	<i class="b2"></i>
</div>
Run Code Online (Sandbox Code Playgroud)