【问题标题】:CSS styles ignored in IE9IE9 中忽略的 CSS 样式
【发布时间】:2011-10-26 06:24:33
【问题描述】:

我的 CSS 样式在 IE 9 中不起作用。它在 IE 8 和 Chrome 中起作用。在下面的代码样式中,cpHeader 在单独的 css 文件中定义。关于为什么 IE 9 不呈现样式的任何线索。

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h1>Welcome to the site</h1>
<div class="cpHeader">
    <asp:Label ID="Label2" runat="server" Text="header text"></asp:Label>
</div> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
...

在 Site.css 中

.cpHeader
        {
            color: white;
            background-image:url('../Images/bg_sm.png');
            font: bold 11px auto "Trebuchet MS", Verdana;
            font-size: 14px;
            cursor: pointer;
            border-style:solid;
            border-bottom-style:none;
            border-width:1px; 
            border-color:#5A5A5A;    
            height:18px;
            padding: 4px;    
            text-align:left;        
        }

编辑:我找到了a mention of a possible problem,但不知道如何修复它。

【问题讨论】:

  • 你是如何将css文件包含在aspx文件中的?
  • 在 Site.master, &lt;link href="~/Styles/Site.css" rel="stylesheet" type="text/css" /&gt;
  • 您要求我们调试前端问题,但向我们展示了后端代码的 sn-ps。这使得故障排除非常困难。

标签: asp.net css internet-explorer-9


【解决方案1】:

这个http://jsfiddle.net/wHszh/ 在IE9 中可以正常工作。 (注意:我将背景更改为黑色,因为图像不会加载到示例中。)

您确定bg_sm.png 的路径是正确的,并且相对于CSS 文件的位置(而不是相对于HTML 页面的位置)?也许它没有加载图像,并且由于您将前景色设置为白色,它正在工作,但您看不到文本,因为它是白底白字?

Firebug/Developer 工具在网络标签中的含义是什么?是否加载了您期望的所有资产?导出的确切 HTML 是什么? CSS文件的其他地方有没有CSS语法问题?

【讨论】:

    猜你喜欢
    • 2012-09-14
    • 1970-01-01
    • 1970-01-01
    • 2020-11-26
    • 2010-10-31
    • 2011-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多