我为我的pie.htc创建了另一个文件夹。但是当我在IE8中加载我的html文件时,它不起作用。我已经尝试为其行为设置不同的位置,但仍然不起作用。
这是我的代码..
behavior: url(/pie/PIE.htc);
正如其他人在其他地方所指出的,以及 http://css3pie.com/documentation/known-issues/这里所记录的,PIE.htc 文件位置必须相对于使用它的页面,而不是相对于 css 文件。 如果需要在多个不同页面中使用 PIE,请考虑动态添加对它的引用。
下面是我们在具有母版页的 C# .Net 应用程序中如何处理它:
在母版页标记的 head 标记之间,放置以下行:
<style id="InlinePageStyles" runat="server" type="text/css"></style>
在母版页代码隐藏的Page_Load方法中,放置以下行:
//get path to PIE.htc and add it to the page as a style (creates a class called Pie)
InlinePageStyles.InnerHtml += string.Format(".Pie {{ behavior: url({0}PIE.htc); }}", ConvertRelativeUrlToAbsoluteUrl(this.Request, ResolveUrl("~/")));
同样在代码隐藏中,添加此方法:
private string ConvertRelativeUrlToAbsoluteUrl(HttpRequest request, string relativeUrl)
{
return string.Format("http{2}://{0}{1}", request.Url.Host, System.Web.VirtualPathUtility.ToAbsolute(relativeUrl), request.IsSecureConnection ? "s" : string.Empty);
}
接下来,从 CSS 中删除该行为。
最后,将"Pie"类添加到需要它的任何页面元素。
希望这有帮助。
行为:url(../pie/PIE.htc);
".."用于文件夹选择,饼图是文件夹
...................
嗨,现在将您的pie.htc
放在根位置和
像这样写到 CSS
behavior: url(PIE.htc);
更多信息