CSS not working in Chrome

懵懂的女人 提交于 2019-12-01 21:14:49

Comparing css links between the page you referenced and sub-pages, you have a "media" attribute in your link:

Problem:

<link href="/stylesheets/css_Sanford.css" rel="stylesheet" type="text/css" media="only screen and (min-device-width: 481px" />

Working:

<link href="/stylesheets/css_Sanford.css" rel="stylesheet" type="text/css" />

Try removing the "media" attribute and it should work fine.

More specifically, it does not appear that "only" is a valid operating for the media attribute. See this W3Schools page for details.

In Google Chrome

>> goto settings
>> search for cache
>> clear browsing data
>> check cached images and files (the past hour / day)
>> clear browsing data

and goto your webpage and press "Ctrl + r"

Hope this solves your issue Cheers.

Make sure that your CSS and HTM/HTML files use the same encoding !

If your HTM/HTML files are encoded as UNICODE, your stylesheet has to be as well.

IE and Edge are not fussy : stylesheets are rendered regardless of the encodings. But Chrome is totally intolerant of unmatched encodings.

I tried every solution/suggestion i could find all over the Internet before i noticed, in my text editor, that i was using different encodings. Once I saved the stylesheets with the same encoding used for the web pages, the problem disappeared.

Are you certain the path is correct? The developer tools in Chrome show the following error.

Failed to load resource: the server responded with a status of 404 (ERROR: The file requested could not be found.) http://www.thesanfordcenter.net/CircularContentCarousel/css/demo.css

Check your source where you are calling your code. The 'stylesheets' folder is coded as 'StyleSheets'. Possibly the case-sensitive is messing it up.

I'm thinking maybe since the expstickybar.css file is rendering correctly and it references the 'stylesheets' folder

Michal Svrcek

The problem could be caused because the browser can't load files:

Failed to load resource: the server responded with a status of 404 (Not Found) error in server

Just throwing this out there. Was having the same issue with chrome. Css sheet would work in explorer but not in chrome. Led me to believe nothing was wrong with the code.

Finally I gave it a closer inspection and found out it was my bad.

Wrong herf="file.css"

Correct href="file.css"

All ways check your coding LoL.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!