lingyired
V2EX  ›  问与答

这个HTML和CSS 合在一起就会出错:Resource interpreted as Image but transferred with MIME type text/css 求高手来看看怎么回事

  •  
  •   lingyired · Oct 11, 2012 · 11309 views
    This topic created in 5057 days ago, the information mentioned may be changed or developed.


    文件下载地址: http://pan.baidu.com/share/link?shareid=75882&uk=671966459

    里面分别是一个html文件和一个css 文件。

    这个html 加载这个CSS 文件的时候就会出现图片上面的错误。
    但是这个html 加载其它CSS 的时候不会,其它html 文件加载这个CSS 也不会出现。。

    这个HTML里面的CLASS和这个CSS 是关联的,应该是哪里写错了,但是我又没找到错误点- -在此求助。

    P.S,这个不是我写的,是同学出现错误后找我帮忙- -结果我没找到错误点
    6 replies    1970-01-01 08:00:00 +08:00
    qiayue
        1
    qiayue  
       Oct 11, 2012
    错误 “Resource interpreted as Image but transferred with MIME type text/css”
    意思是你把一个 css 文件当做图片使用了
    看你的图片,在 index.html 的 62 行看看,是不是把 css 的 url 写到图片的 src 里了。
    lingyired
        2
    lingyired  
    OP
       Oct 11, 2012
    @qiayue 没有。里面没有src
    lingyired
        3
    lingyired  
    OP
       Oct 11, 2012
    @qiayue 62行是</html>
    lingyired
        4
    lingyired  
    OP
       Oct 11, 2012
    自行修复,出现这情况的原因是,CSS 中有:
    background: url("") ;
    当background中的url 为空的时候,在Chrome 下就会出现问题
    nicolazj
        5
    nicolazj  
       Oct 11, 2012
    原来如此 以前也出现过
    qiayue
        6
    qiayue  
       Oct 11, 2012
    @lingyired 原来如此,那就是 chrome 把空的路径用文件自身 url 替换了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2784 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 09:25 · PVG 17:25 · LAX 02:25 · JFK 05:25
    ♥ Do have faith in what you're doing.