is type =" text / css"必须在< link>标签? [英] Is type="text/css" necessary in a <link> tag?

本文介绍了is type =" text / css"必须在< link>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!


我想知道是否需要使用< link rel =stylesheettype =text / csshref = ...> over < link rel =stylesheethref = ...> rel =stylesheet标记了它是样式表的信息 - 因此 text / css

HTML使用的唯一样式表格式是CSS,因此 text / css 'say'到浏览器?有些网站似乎添加了 type =text / css属性( http:// www / ),而其他则不会( ) 。

那么,在 type =text / css >< link rel =stylesheet> 元素,是否需要包含它?



Html 4 W3.org规格 / p>

http ://

类型代表样式表的MIME类型。我看到的唯一支持的值是Text / CSS,这可能是为什么HTML5已经删除它。我想象他们有它的早期版本允许未来的扩展可能性从来没有发生。


I was wondering whether or not it is necessary to use <link rel="stylesheet" type="text/css" href=...> over <link rel="stylesheet" href=...>. The rel="stylesheet" marks the information that it is a stylesheet - so text/css doesn't actually add anything as far as I'm concerned.

The only stylesheet format used by HTML is CSS anyway, so what does text/css 'say' to the browser? Some websites seem to add the type="text/css" attribute (, whilst other ones don't (

So, what is the use of type="text/css" in a <link rel="stylesheet"> element, and is it necessary to include it?


It's not required with the HTML5 spec, but for older versions of HTML is it required.

Html 4 spec

Type stands for The MIME type of the style sheet. The only supported value I have ever seen is Text/CSS, which is probably why HTML5 has dropped it. I imagine they had it for earlier versions to allow future expansion possibilities which never happened.

Using HTML5 and not specifying the type, I have run so far into no problems with compatibility even when testing older versions of IE.

这篇关于is type =&quot; text / css&quot;必须在&lt; link&gt;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

登录 关闭
发送“验证码”获取 | 15天全站免登陆