CSS @import 在IE中的问题

这两天做了一个换肤的小 DEMO 发现在 base.css 中使用 @import url(『index.css』) 在IE下的加载好象是异步的,其实并不是这样,事实上在 IE 下他的加载是有顺序的 import 之后的 css 相当于在页面的最底部加载了一个 <link /> 标签,以后使用需要注意了,按照前端的优化习惯,css 必须是放在 head 中的,才能保证页面在加载进来的时候有一个正确的渲染。否则就会出现部分 CSS 样式异常的情况。参考资料如下

Choose <link> over @import
One of the previous best practices states that CSS should be at the top in order to allow for progressive rendering.
In IE @import behaves the same as using <link> at the bottom of the page, so it’s best not to use it.

Choose <link> over @import One of the previous best practices states that CSS should be at the top in order to allow for progressive rendering.In IE @import behaves the same as using <link> at the bottom of the page, so it’s best not to use it.

發表回覆

你的電郵地址並不會被公開。 必要欄位標記為 *