为什么人们继续使用 "text/css"?

Why people continue to use "text/css"?

我已经阅读了几个 Google 搜索的结果,例如这个很好的问题:Is type="text/css" necessary in a <link> tag?。但是,我目前正在查看一些 css3(这不是 新的)代码,我到处都看到 text/css

是不是变了,或者这只是我们(年轻人)不应该继承的老习惯?

text/css 在 HTML5 中不是必需的,但是 WC3 规范确实提到了它,因此建议在任何 CSS 导入语句中使用它。它们将在没有 "text/css" 的情况下工作,因为规范定义了在没有 "text/css" 的情况下的正确行为 - 但我不会依赖所有旧的(或未来的)浏览器以相同的方式处理丢失的 属性 。因此,包含它只是一个好习惯。

如果参考this question, it seems that the HTML5 spec says that this attribute is advisory (it says, that a look here).

The type attribute gives the MIME type of the linked resource. It is purely advisory. The value must be a valid MIME type.

For external resource links, the type attribute is used as a hint to user agents so that they can avoid fetching resources they do not support. If the attribute is present, then the user agent must assume that the resource is of the given type (even if that is not a valid MIME type, e.g. the empty string). If the attribute is omitted, but the external resource link type has a default type defined, then the user agent must assume that the resource is of that type. [...] If the attribute is omitted, and the external resource link type does not have a default type defined, but the user agent would obtain the resource if the type was known and supported, then the user agent should obtain the resource under the assumption that it will be supported.

所以你可以指定它,但不是强制性的。

有一次我遇到了一个奇怪的前端错误的客户。最后他得到了一个代理(我真的不知道那东西是如何工作的)没有 text/css.

不允许资源

2014年在一家大公司

也许是独一无二的,再也没有遇到过同样的问题!

没有改变,它用于向后兼容,随着时间的推移可能会越来越少出现,因为更多已安装的浏览器将支持 HTML5。

"Has something changed, or this is just an old habit that we (the young people) should not inherit?" - 是的,不要使用它。
从 html <link> 中不需要 4 类型,它是为了将来可能永远不会出现的功能而放在那里的。就像一种新的样式元素方式,这就是为什么你应该显式 text/css
但正如我所说,你不应该使用它,因为它没有用。