CSS Chrome 未加载样式表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7630010/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Chrome not loading Stylesheet
提问by GreatestSwordsman
Seems like Google Chrome is not displaying my site according to the stylesheet.
似乎 Google Chrome 没有根据样式表显示我的网站。
When the page first load, it loads fine...but then it changes to raw html format towards the end of the page load.
当页面第一次加载时,它加载得很好……但是在页面加载结束时它会更改为原始 html 格式。
It ends up looking like this (you can see web address at the top bar):
它最终看起来像这样(您可以在顶部栏中看到网址):
[点击查看全尺寸]
I have 2 style sheets, one is an "alternative" that a user can switch between by clicking the Light/Dark buttons at top right of the site.
我有 2 个样式表,一个是“替代”样式表,用户可以通过单击站点右上角的 Light/Dark 按钮在它们之间进行切换。
Why is this happening? I never had a problem before.
为什么会这样?我以前从来没有遇到过问题。
My specs: Mac OS X with Google Chrome 14.0.835.186
我的规格:Mac OS X 和 Google Chrome 14.0.835.186
回答by Mittenchops
Do you have HTTPS everywhere + Adblock installed? If so, I've found that clicking through google search results will often produce this behavior when the main site has no, or limited https support.
您是否到处都安装了 HTTPS + Adblock?如果是这样,我发现当主站点没有或有限的 https 支持时,点击谷歌搜索结果通常会产生这种行为。
I notice the same behavior, with those extensions, when I search for and click through an XKCD comic, for example.
例如,当我搜索并点击 XKCD 漫画时,我注意到这些扩展的相同行为。
Temporarily disabling https everywhere, or re-entering the URL without https seems to fix it for me.
暂时在任何地方禁用 https,或者重新输入没有 https 的 URL 似乎对我来说都解决了。
回答by Jhourlad Estrella
Maybe a caching problem on your side. Can you try "Shift+Ctrl+R"?
也许你这边有缓存问题。你能试试“Shift+Ctrl+R”吗?
回答by sean
Had this same issue, spent hours going around in circles wondering "What the hell have I done!", I tried many of the suggestions from this site and many others but the thing that worked for me and I felt kind of stupid afterwards for not trying it was to disable ad-blocker for chrome, followed by a shift+f5 and problem solved.
有同样的问题,花了几个小时在圈子里转来转去想“我到底做了什么!”,我尝试了这个网站和许多其他网站的许多建议,但对我有用的东西,后来我觉得有点愚蠢,因为没有尝试是禁用 chrome 的广告拦截器,然后按 shift+f5 并解决问题。
回答by John Keyes
I tried this on OS X with the same Chrome version as you and everything is rendered correctly for the dark and light versions. It could be a caching problem for you. Hold down the shift key while you reload the page. This will force the browser to get all of the resources and ignore the cached versions.
我在 OS X 上尝试过,使用与您相同的 Chrome 版本,所有内容都为深色和浅色版本正确呈现。这对你来说可能是一个缓存问题。重新加载页面时按住 shift 键。这将强制浏览器获取所有资源并忽略缓存版本。
回答by int_ua
On my friend's laptop it was caused by some DNS problems. After changing DNS to 8.8.8.8 everything is fine.
在我朋友的笔记本电脑上,它是由一些DNS 问题引起的。将 DNS 更改为 8.8.8.8 后一切正常。
回答by Kavin
Change css charset to UTF8. It fixed my issue.
将 css 字符集更改为 UTF8。它解决了我的问题。