【问题标题】:ASP.NET Global.asax - IE conditional stylesheet in bundleASP.NET Global.asax - 捆绑包中的 IE 条件样式表
【发布时间】:2014-04-12 11:17:44
【问题描述】:

在我们的应用程序中,我们将样式捆绑在 Global.asax Application_Start 中,例如

' CSS Bundle
Dim brandRef = ConfigurationManager.AppSettings("SiteBrandRef")
Dim cssBundle = New StyleBundle("~/content/css")
cssBundle.IncludeDirectory("~/CSS", "*.css")
cssBundle.IncludeDirectory("~/CSS/" & brandRef, "*.css")
cssBundle.IncludeDirectory("~/CSS/" & brandRef & "/design", "*.css")
cssBundle.IncludeDirectory("~/CSS/" & brandRef & "/layout", "*.css")
BundleTable.Bundles.Add(cssBundle)

有没有办法将此模式与 IE7、IE8 样式表一起使用?也许是一个单独的捆绑包?我认为Global.asax没有办法进行用户代理检测

【问题讨论】:

    标签: asp.net css vb.net internet-explorer-8 internet-explorer-7


    【解决方案1】:

    在 Global.asax 中是不可能的。这必须在客户端代码中完成。

    这是IE version specific CSS上的一篇很好的文章

    针对所有版本的 IE

    <pre>< !--[if IE]>
        <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
    <![endif]-->
    

    目标 IE 8 和更高

    <!--[if gt IE 7]>
        <link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
    <![endif]-->
    <!--[if gte IE 8]>
        <link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
    <![endif]-->
    

    【讨论】:

    • 感谢您的确认,我怀疑是这样 - 我们在母版页中使用此条件模式,如果这是唯一的方法,将继续这样做!
    猜你喜欢
    • 2016-09-05
    • 1970-01-01
    • 2012-11-20
    • 2013-01-19
    • 2014-11-29
    • 2012-10-03
    • 1970-01-01
    • 2012-07-27
    • 2017-12-18
    相关资源
    最近更新 更多