为什么我们必须使用“链接” CSS文件的标签 [英] why do we have to use "link" tag for css files
问题描述
为什么不允许这样做:
< style src = someCssFile.css>< / style>
其中允许这样做:
< script src = someJsFile.js>< / script>
我不明白为什么我必须对CSS文件使用链接标记。我认为使用样式标签会更有意义。
您知道所有这些标签何时以HTML引入吗?使用< LINK>
标记而不是< style>
标记是有原因的。
对于使用HTML的人来说,最想知道HTML的去向和去向是最有意义的。
HTML1.0
- HTML1.0是最早的HTML版本,始于1989年直到1994年。这是一个非常有限的版本,仅包含20个元素。但是20个元素中没有链接或样式标签。
HTML2.0
- 此版本创建于1995年,对HTML1.0进行了重大改进。
< link>
标记已添加到此版本。< LINK>
标记是指向其他文档的通用链接。
< link rel = stylesheet href = styles.css>
HTML3.2
- HTML3.2版本于1997年1月得到W3联盟的认可,并得到了许多人的认可,其中包括著名的浏览器,例如Netscape和Microsoft。
此版本包括样式和脚本标记。< style>
标记保留供内部样式表将来使用。
< pre class = lang-html prettyprint-override>
< style type = text / css> < / style>
因此< link>
标记已用于在页面中包含外部样式。
< style>
标记是在< link>
标记之后引入的,但不是
因为已经有了< link>
标签来包含外部样式,并且HTML从未使单个标签贬值。
使用的来源:链接
Why this is not allowed:
<style src="someCssFile.css"></style>
whereas this is allowed:
<script src="someJsFile.js"></script>
I don't understand why i have to use link tag for css files. I think it would make more sense to use style tag.
Do you know when all these tags introduced in HTML? There is a reason why the <LINK>
tag is used instead of the <style>
tag.
It makes the most sense for individuals using HTML who want to see where HTML has been and where it is going.
HTML1.0
- HTML1.0 was the earliest version of HTML, used from 1989 to 1994. It was a very limited version and only contained 20 elements. But there was no link or style tag in the 20 elements.
HTML2.0
- This version was created in 1995, with significant improvements to HTML1.0.
A
<link>
tag was added to this version. The<LINK>
tag is presented as a general purpose link to other documents. Styling sheets are indicated as a possibility.
<link rel="stylesheet" href="styles.css">
HTML3.2
- The HTML3.2 version was endorsed by the W3 consortium in January 1997 and was approved by many, including notable browsers such as Netscape and Microsoft.
And this version included a style and script tag.
<style>
tag "Reserved for future use with internal style sheet."
<style type="text/css"> </style>
So the <link>
tag is already used to include the external style in the page.
The <style>
tag was introduced after the <link>
tag, but it is not used to include external style.
Because there was already a <link>
tag to include the external style and HTML has never devalued a single tag.
Sources used: Link
这篇关于为什么我们必须使用“链接” CSS文件的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!