【问题标题】:Why is CSS being rendered inside CDATA on my page seemingly from nowhere?为什么 CSS 在我页面上的 CDATA 中呈现似乎不知从何而来?
【发布时间】:2015-12-01 00:51:41
【问题描述】:

我的母版页文件的标题在我的代码中如下所示:

<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder ID="Head1" runat="server">
    </asp:ContentPlaceHolder>
    <link href="SmartPeep.css" rel="stylesheet" type="text/css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>

当我查看呈现的网站时,它看起来像这样:

<head><title>
    Smartpeeps :: Home
</title>
    <!-- Add jQuery library -->
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

    <!-- Add mousewheel plugin (this is optional) -->
    <script type="text/javascript" src="fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>

    <!-- Add fancyBox -->
    <link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
    <script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>

    <!-- Optionally add helpers - button, thumbnail and/or media -->
    <link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
    <script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
    <script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>

    <link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
    <script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $(".fancybox").fancybox();
        });
    </script>
    <style type="text/css">
        .auto-style2 {
            color: #FF3300;
        }
    </style>
<link href="SmartPeep.css" rel="stylesheet" type="text/css" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<style type="text/css">
    /* <![CDATA[ */
    #SmartpeepMainMenu img.icon { border-style:none;vertical-align:middle; }
    #SmartpeepMainMenu img.separator { border-style:none;display:block; }
    #SmartpeepMainMenu img.horizontal-separator { border-style:none;vertical-align:middle; }
    #SmartpeepMainMenu ul { list-style:none;margin:0;padding:0;width:auto; }
    #SmartpeepMainMenu ul.dynamic { z-index:1; }
    #SmartpeepMainMenu a { text-decoration:none;white-space:nowrap;display:block; }
    #SmartpeepMainMenu a.static { padding-left:0.15em;padding-right:0.15em; }
    #SmartpeepMainMenu a.popout { background-image:url("/Smartpeeps/WebResource.axd?d=rizp0zWlqOPWgeU28unXjfAtIHIHFUu3Rylnmz9M0DW1D3_YMtnoL8fA7gnTmqC_vPI1gxN8QXg-9vknZDLSsY6V8Vc7p_i6k8fLKNrprps1&t=635116993265614829");background-repeat:no-repeat;background-position:right center;padding-right:14px; }
    /* ]]> */
</style></head>

我不知道在哪里可以找到呈现该 CSS 的 CDATA。

问题在于 CSS 正在围绕主站点菜单阻止我的页面设计。

很抱歉,我无法提供更多信息,但我不知道这里有哪些更多信息会有所帮助,我的意思是我不知道这是从哪里来的......

如果我可以编辑它甚至删除它,那就太理想了。

编辑

这是我的 web.config 文件:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="ChartImageHandler" value="storage=file;timeout=20;URL=~/ChartTemp/;"/>
  </appSettings>
  <connectionStrings/>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms name="SmartPeeps" loginUrl="~/Login.aspx" timeout="30" slidingExpiration="true" cookieless="UseCookies"/>
    </authentication>
    <authorization>
      <allow users="?"/>
    </authorization>
    <pages controlRenderingCompatibilityVersion="4.0">
      <namespaces>
        <clear/>
        <add namespace="System"/>
        <add namespace="System.Collections"/>
        <add namespace="System.Collections.Generic"/>
        <add namespace="System.Collections.Specialized"/>
        <add namespace="System.Configuration"/>
        <add namespace="System.Text"/>
        <add namespace="System.Text.RegularExpressions"/>
        <add namespace="System.Linq"/>
        <add namespace="System.Xml.Linq"/>
        <add namespace="System.Web"/>
        <add namespace="System.Web.Caching"/>
        <add namespace="System.Web.SessionState"/>
        <add namespace="System.Web.Security"/>
        <add namespace="System.Web.Profile"/>
        <add namespace="System.Web.UI"/>
        <add namespace="System.Web.UI.WebControls"/>
        <add namespace="System.Web.UI.WebControls.WebParts"/>
        <add namespace="System.Web.UI.HtmlControls"/>
        <add namespace="AjaxControlToolkit"/>
      </namespaces>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
        <add tagPrefix="act" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
      </controls>
    </pages>
    <httpRuntime maxRequestLength="1048576" executionTimeout="3600" requestLengthDiskThreshold="1048576"/>
    <customErrors mode="Off"/>
    <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>
  </system.web>
  <location path="Members">
    <system.web>
      <authorization>
        <deny users="?"/>
        <!-- deny unauthenticated users -->
        <allow users="*"/>
        <!-- allow everyone else (authed users) -->
      </authorization>
    </system.web>
  </location>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <remove name="ChartImageHandler"/>
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </handlers>
  </system.webServer>
</configuration>

【问题讨论】:

  • 你能显示你的web.config 是否配置了任何SmartPeep 模块?
  • @GlennFerrie 添加了我的 web.config 文件...虽然那里没有任何 SmartPeep 模块

标签: css asp.net master-pages cdata


【解决方案1】:

一个很好的测试方法是使用 chrome。

使用 chrome 访问页面。在页面内右键单击并选择“检查元素”。

它会打开一个右侧栏 - 您可以选择呈现的 html 代码并

它会告诉你什么 CSS 正在影响那个元素以及哪个文件提供了 CSS。

在此示例中 - 它显示 css 来自 index.html 内部和第 10 行

【讨论】:

  • 它引用了我粘贴的 CDATA 块中的 default.aspx:54
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-09
  • 2017-09-10
  • 2012-08-04
  • 2022-11-23
  • 1970-01-01
相关资源
最近更新 更多