由 IIS 提供服务时 CSS 呈现方式不同

发布于 2025-01-07 10:24:43 字数 445 浏览 0 评论 0原文

这个问题似乎不是特定于浏览器的,通常适用于 webkit/gecko/mozilla 样式中的样式。

例如,当我做一个网站模型并使用如下样式:

element.class {
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px; 
    border: 1px solid #800000;
}

element:last-child {
    ....
}

通过双击打开文件时,样式将按我的预期呈现。但是,当将该样式应用于 IIS7 提供的实时站点时,该样式似乎已被忽略。我已经查看了该网站的 IIS 配置,但似乎不明白为什么会这样。

任何帮助将不胜感激。

谢谢!

This problem doesn't seem browser specific and generally applies to style in the webkit/gecko/mozilla styles.

For example, when I do a site mockup and use a style like:

element.class {
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px; 
    border: 1px solid #800000;
}

or

element:last-child {
    ....
}

When opening the file via double-clicking on it, the style renders as I would expect. However, when applying the style to a live site served by IIS7, the style seems to have been ignored. I've gone through the site's IIS config and can't seem to see why this would be.

Any help would be greatly appreciated.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哑剧 2025-01-14 10:24:43

这可能不是由于网络服务器造成的。以下是故障排除时可以查看的一些内容:

  1. CSS 文件是否正确加载?检查浏览器开发者工具中加载的资源。
  2. 是否可能是您加载了一个缓存的 CSS 文件?使用开发人员工具检查加载的 CSS 并确保您的 CSS 规则位于其中。
  3. 实时站点是否可能有另一个具有更高 CSS 特异性的 CSS 规则来覆盖您的 CSS 规则?通常您也可以在开发人员工具中看到这一点,因为在这种情况下,CSS 规则有一个删除线或类似的内容,表明它已被覆盖。

That is probably not due to the web server. Here are a few things you could look for when troubleshooting:

  1. Is the CSS-file loaded properly? Check the loaded resource in your browsers developer tools.
  2. Could it be that you have a cached CSS-file that is loaded instead? Use the developer tools to check the CSS that is loaded and make sure that your CSS-rule is in there.
  3. Is it possible that the live site has another CSS-rule with higher CSS-specificity that override your CSS-rule? Usually you can see this in developer tools as well, as the CSS-rule in that case has a strike-through or similar to indicate that it has been overwritten.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文