【问题标题】:CSS3PIE with ASP.NET MVC3CSS3PIE 与 ASP.NET MVC3
【发布时间】:2011-08-05 15:46:22
【问题描述】:

我正在尝试让 css3pie 与 asp.net mvc 一起使用,但由于某种原因它无法正常工作。

我有一个包含内联 CSS 的视图,如下所示:

@{
    ViewBag.Title = "Home Page";
}

<div>


    <div class="contentWrapper" style="width:600px;margin:25px auto;">
        Hello World
        <input name="button" value="Button" class="button" type="button" />
    </div>
</div>


@section BreadCrumb {
    <div class="breadcrumb">
    </div>
    <div class="pageTitle">
        <h1></h1>
    </div>
} 

@section HeaderContent {

<style type="text/css"> 

    .contentWrapper  
    {
        border: 1px solid #ddd; 
        padding: 30px 40px 20px 40px; 
        background: #fff;
        /* -- CSS3 - define rounded corners for the form -- */  
        -webkit-border-radius: 10px;
        -moz-border-radius: 10px;
        border-radius: 10px;        

        /* -- CSS3 - create a background graident -- */

        background: -webkit-gradient(linear, 0% 0%, 0% 40%, from(#EEE), to(#FFFFFF)); 
        background: -moz-linear-gradient(0% 40% 90deg,#FFF, #EEE); 
         -pie-background: linear-gradient(#FFF, #EEE); 


        -webkit-box-shadow:0px 0 50px #ccc;
        -moz-box-shadow:0px 0 50px #ccc; 
        box-shadow:0px 0 50px #ccc;     

        behavior: url(PIE.htc);
    }   


    </style> 

}

我尝试将 PIE.htc 文件放在我的项目的根目录、views 目录和许多其他地方,但它看起来不像在 IE8 及以下版本中工作。 htc 文件到底应该放在哪里,我如何通过内联 css 和外部样式表正确引用它?

谢谢

【问题讨论】:

  • 您是否确认该文件是由浏览器下载的,无论是使用 Web 开发控制台还是 fiddler?
  • 是的,它看起来正在下载它,但是内容类型应该是 text/x-component 吗?

标签: asp.net-mvc-3 razor css3pie


【解决方案1】:

我明白了。将其与您的 CSS 文件一起添加到 Content 文件夹,然后针对 CSS 文件中的行为执行以下操作:

behavior: url('../../Content/PIE.htc');

无论如何它对我有用。

【讨论】:

    猜你喜欢
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-27
    • 2012-01-17
    • 1970-01-01
    • 2013-08-28
    相关资源
    最近更新 更多