How To Recover CSS Rules From A Corrupted CSS File

陌路散爱 提交于 2019-12-13 09:14:27

问题


My .css file was working fine but today I noticed the website is not acting based on CSS rules so I tried to inspect the rues on browser and surprisingly I noticed the CSS file is empty! I tried to open the style.css file in Notepad++ and this is how it looks like

I also tried to open the file in Bracket editor which I got this message

Can you please let me know if there is a way to fix this issue and retrieve the CSS rules from these NULs?


回答1:


If your file is indeed corrupted, and you have site backups as part of your hosting plan, restore your website to a point where your file worked. (Many web hosts that offer backups will store 30 days' worth, depending on your hosting plan.)

If you don't have such a hosting plan, go to Wayback Machine and search for your URL. Pick a snapshot date when your site was working. Look in your source code and find a link to Wayback's cached version of your CSS file. Copy your CSS from there.

Alternatively, try searching for your website in Google. Unless you have noarchive tags on your site, there should be a link right in your search results to access a cached version of your site. If Google last crawled your site before your file got corrupted, you should be able to access your cached CSS file through the source code (or a link in Dev Tools).

Finally, check out this thread:

https://groups.google.com/forum/#!topic/brackets-dev/4hEn8qs9MKs

You may be able to open the file in a third code editor and save it as UTF-8.



来源:https://stackoverflow.com/questions/44829325/how-to-recover-css-rules-from-a-corrupted-css-file

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