这两种将html页面链接到css文件的方法有什么区别? [英] What's the difference between these two methods of linking a html page to a css file?

查看:112
本文介绍了这两种将html页面链接到css文件的方法有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读关于css的几个教程,我看到了两种不同的方式来声明应该使用css文件来设置页面的样式:

I've been reading through a few tutorials about css, and I saw two different ways to state which css file should be used to style the page:

<style type="text/css">@import url("style.css");</style>

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

它们之间有什么区别?

What's the difference between them? Which one should I use?

推荐答案

除非您使用非常 old浏览器(netscape 4.x和ie 3.x)。您可以在此处阅读完整的下拉菜单。 p>

There isn't much difference unless you are using very old browsers (netscape 4.x and ie 3.x). You can read a complete lowdown on what each means 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).

这篇关于这两种将html页面链接到css文件的方法有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆