link和@import的区别?what's the diffrence between link and @import ?

What's the diffrence between link and @import ?

  • the link belongs to the tags of xhtml, but @import is provided by css
  • the link will loading when the web page is loaded, but css that referenced by @import will wait until the web page is loaded.
  • the @import just can be recognized in ie5 and above, but link is xhtml tag, doesn't has the issue of compatibility.
  • the weight of the link style is higher than the weight of @import
  • the difference of controling the style of dom, we can only use the link tag when using the js to control the dom to change its style. because the @import is not controllable by the dom.

link和@import的区别?

  • link属于XHTML标签,而@importCSS提供的。
  • 页面被加载时,link会同时被加载,而@import引用的CSS会等到页面被加载完再加载。
  • import只在IE 5以上才能识别,而linkXHTML标签,无兼容问题。
  • link方式的样式权重高于@import的权重。
  • 使用dom控制样式时的差别。当使用javascript控制dom去改变样式的时候,只能使用link标签,因为@import不是dom可以控制的。

你可能感兴趣的:(css,css3,前端)