gpt4 book ai didi

css - Safari 不会从外部服务器加载 css 文件

转载 作者:行者123 更新时间:2023-11-28 18:36:01 24 4
gpt4 key购买 nike

我正在开发的网站之一正在加载外部样式表:

@import url(http://www.othersite.com/stylesheet.css);

除了 Safari 之外,这在每个浏览器中都能正常工作。 Safari 甚至不会尝试加载它。我做错了什么?

最佳答案

它会不会与这个旧错误有关:http://www.thinkoomph.com/thinking/2011-04/odd-css-bug-in-webkit-and-safari-4/

The solution is simple. My @import directive was surrounded by other CSS instructions. Whereas IE tolerates this, the actual W3C spec declares that @import directives should appear before any other CSS instructions, and Firefox honors this restriction. Thus, my @import directive was being ignored. I moved it to the top of the file and everything started working.

At most one @charset rule may appear in an external style sheet — it must not appear in an embedded style sheet — and it must appear at the very start of the document, not preceded by any characters.

关于css - Safari 不会从外部服务器加载 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12716747/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com