这两种将HTML页面链接到css文件的方法有什么区别?

前端之家收集整理的这篇文章主要介绍了这两种将HTML页面链接到css文件的方法有什么区别?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直在阅读关于css的几个教程,并且我看到了两种不同的方式来说明哪个CSS文件应用于对页面进行样式化:
<style type="text/css">@import url("style.css");</style>

<link rel="stylesheet" type="text/css" href="style.css" />

他们有什么区别?我应该使用哪一个?

解决方法

除非您使用非常旧的浏览器(netscape 4.x和ie 3.x),否则没有多大的区别。你可以看到一个完整的下降,每个意味着什么 here

From a standards viewpoint,there is no difference between linking to an external style sheet or importing it. Either way is correct,and either way will work equally well (in most cases).

原文链接:https://www.f2er.com/html/232582.html

猜你在找的HTML相关文章