MVC中的css3pie,pie.htc文件放在哪里?
我一直在尝试在我的 MVC 项目中使用 Css3pie 来渲染圆角面板,但到目前为止还没有运气。
我按照正常 html 页面的示例进行操作,它运行得很好,但在我的 MVC 项目中却不起作用。 我认为这与 MVC 中混淆的“pie.htc”文件的路径有关,
我将“pie.htc”文件放在项目文件夹(根)和我的 css 文件中,我使用: 行为: url(/PIE.htc);
我认为 MVC 路由器需要修改以接受 htc 文件扩展名? 抱歉,我是 MVC 新手。有没有人尝试过pie.htc并让它在MVC项目中工作,请帮忙?
谢谢!
I've been trying to use the Css3pie in my MVC project to render rounded corner panel but have no luck so far.
I follow the sample with normal html page and it works perfectly but not in my MVC project.
I think it is something to do with the path of the 'pie.htc' file that is being confused in MVC
I place the 'pie.htc' file in project folder (root) and in my css file, i use:
behavior: url(/PIE.htc);
I think the MVC router needs to be modified to accept htc file extension?
Sorry im new with MVC. Has anyone tried pie.htc and have it working in MVC project, please help?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
作为旁注(也许它无论如何都会解决您的问题),如果您不想在根目录中使用 .htc 文件,您可以执行以下操作来解决行为固有的相对路径问题。这不是最漂亮的解决方案,但效果很好 -
在您的 css 中,将行为定义为:
behavior: url(CSS3PIE);
在您的 Global.asax.cs 中有以下代码:
然后 查找与“CSS3PIE”匹配的任何请求并从正确的位置返回 .htc 文件。
As a side note (and maybe it will fix your issue anyway) if you don't want to have the .htc file at your root, you can do the following to get around the relative pathing issues inherent with behaviors. It's not the prettiest solution, but it works well -
In your css, define the behavior as:
behavior: url(CSS3PIE);
Then in your Global.asax.cs have the following code:
It will simply look for any request matching "CSS3PIE" and return the .htc file from the correct location.
将以下内容添加到
Global.asax
文件的RegisterRoutes(RouteCollection paths)
方法中Add the following to the
RegisterRoutes(RouteCollection routes)
method of theGlobal.asax
file在样式表中,添加以下
行为
:In your stylesheet, add the following
behavior
: