上SCRIPT,STYLE和LINK元素类型的属性仍然需要? [英] Are Type Attributes on SCRIPT, STYLE, and LINK elements still needed?
问题描述
您将看到许多网站有以下类型code的:
You will see many sites with the following type of code:
脚本元素:
<script type="text/javascript">
//javascript here
</script>
链接元素:
<link rel="stylesheet" href="url.css" type="text/css" media="all" />
风格元素:
<style type="text/css">
/* CSS */
</style>
我的问题是这样的:
My question is this:
是键入
在流行的浏览器需要的属性,今天?
Are the type
attributes needed in the popular browsers today?
(热门意8+ IE,火狐,Webkit内核,Opera和Chrome浏览器)
(Popular meaning IE 8+, Firefox, Webkit, Opera and Chrome)
如果你的会发生什么不的包括他们?
注:答案需要覆盖HTML5和XHTML文档类型,如果有在两者之间行为的差
Note: The answer needs to cover both HTML5 and XHTML doctypes if there is a difference in behavior between the two.
推荐答案
总之,并不需要他们,因为 HTML5 ,但被要求 W3C 在标准的 HTML4 / XHTML
In short, they are not required since HTML5, but are required by W3C standards in HTML4/XHTML.
在 HTML5 键入
的剧本
标签:
键入 - 此属性标识code嵌入的脚本语言
一个脚本元素中或通过元素的src属性引用。
这被指定为一个MIME类型;支持的MIME类型的例子
包括文本/ javascript中,文本/ ECMAScript中,应用程序/ JavaScript和
应用程序/ ECMAScript的。 如果这个属性不存在,该脚本
视为JavaScript的。
type - This attribute identifies the scripting language of code embedded within a script element or referenced via the element’s src attribute. This is specified as a MIME type; examples of supported MIME types include text/javascript, text/ecmascript, application/javascript, and application/ecmascript. If this attribute is absent, the script is treated as JavaScript.
在 HTML4 和 XHTML 它要求的 W3C标准的。
有关风格
和链接
键入
:
在 HTML5 ,type属性不再是必需的。 默认值是
文/ CSS。
In HTML5, the type attribute is no longer required. Default value is "text/css".
这篇关于上SCRIPT,STYLE和LINK元素类型的属性仍然需要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!