我的测试方法是:
1/ PIE.htc 是否被 IE 发现? PIE documentation 声明:
注意:此路径是相对于正在查看的 HTML 文件的,而不是调用它的 CSS 文件。
为了验证您的 Compass 文件中指示的目录是否正常,您可以在同一目录中添加图像并尝试将其显示为 HTML 图像,例如:
<body><div>
<img src="stylesheets/yourtestimage.png" alt="If you can read this, it failed" width="400" height="400">
</div></body>
然后应该清楚这个目录是否是好的目录:)
2/ 然后尝试一些没有 Compass 代码的简单 CSS 规则,以避免 Compass 可能导致的问题,而不涉及 PIE。示例:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>PIE and border-radius</title>
<style type="text/css">
p {
width: 400px;
height: 100px;
line-height: 100px;
vertical-align: middle;
text-align: center;
color: yellow;
background-color: darkgreen;
border-radius: 5px 6px 7px 8px;
pie-border-radius: 30px; /* shouldn't be necessary but just in case ... Please test with and without this prefixed property */
behavior: url(***/PIE.htc);
</style>
</head>
<body>
<p>this paragraph should be rounded in lesser IE</p>
</body>
</html>
3/ 其他 CSS3 指令一一添加,仍然在 CSS 中,没有 Compass 代码。 background 不会被 PIE 解析,您必须使用 -pie-background (不确定您的 Compass 是否会生成它?)。
首先是一个没有多重背景的简单线性渐变:
p {
/* (...) */
-pie-background: linear-gradient(#F44, #400); /*PIE*/
/* (...) */
}
然后是多重背景:
p {
/* (...) */
-pie-background: url(***/small_or_transparent_image1.png) left top no-repeat,
url(***/repeating_image2.png) left top repeat,
darkgreen;
/* (...) */
}
最后是混合:
p {
/* (...) */
-pie-background: url(***/small_or_transparent_image1.png) left top no-repeat,
linear-gradient(#F44, #400),
darkgreen;
/* (...) */
}
顺便说一句,您的多背景是否在 Firefox 和 webkit 浏览器上使用 -moz-linear-gradient 等成功显示? generator from Colorzilla 可以帮助您处理所有这些前缀(对于 Compass 的下一步,它恰好通过“切换到 scss”支持其格式,以防您还不知道)。
4/ 然后在 Compass 文件中添加变量和 scss 代码。我帮不了你,我使用 LESS 或纯 CSS。您应该对照您的 Compass 代码检查生成的 CSS:后者是否会生成您想要生成的 CSS?