如何添加mhtml / mht文件作为相对路径

时间:2012-03-06 18:35:54

标签: css internet-explorer mhtml

我正在尝试将外部mhtml资源添加到css。 我有一个像这样的CSS条目:

*background-image: url(mhtml:file://C:/folder/base64.mht!image1);
*background-image: url(mhtml:http://domain.com/base64.mht!image1);

效果很好,但我需要添加base64.mht文件作为相对路径。 有可能吗?

PS。这是将带有base64图像的css添加到IE浏览器的技巧: http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/ Mayby是在IE7上向css添加base64图像的更好方法吗?

我将不胜感激任何帮助。 马尔钦

1 个答案:

答案 0 :(得分:0)

使用document.location的表达式来引用相对路径:

background-image: expression("url(mhtml:" + document.location + "!polloloco)");