开发者

Is there a style type besides text/css? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

style type="text/css" … what else is there?

I see that when defining a css section it's always

开发者_JAVA技巧<style type="text/css">
</style>

Is there anything else it could be? Just curious.


HTML 4 and 5 leave open the possibility of other types, but do not specify any besides "text/css". In practice, I have never encountered a case where anything but "text/css" is used. For this reason, the HTML5 specification made the type attribute optional. If it is omitted, the default type "text/css" is used. See the style tag specification for details:

The type attribute gives the styling language. If the attribute is present, its value must be a valid MIME type that designates a styling language. The charset parameter must not be specified. The default value for the type attribute, which is used if the attribute is absent, is "text/css". RFC2318

In HTML 4 documents, the type attribute must be specified. The specification does not limit the values that can be used:

This attribute specifies the style sheet language of the element's contents and overrides the default style sheet language. The style sheet language is specified as a content type (e.g., "text/css"). Authors must supply a value for this attribute; there is no default value for this attribute.

In old versions of HTML (<= 4) the type attribute appears to be an attempt to maintain compatibility with the <link> method of importing stylesheets, where the type is required:

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


Apparently, there is no default for this

http://www.w3.org/TR/html4/present/styles.html#adef-type-STYLE

Authors must supply a value for this attribute; there is no default value for this attribute.

There are many options, although text/css seems the only reasonable one for style.

http://www.w3.org/TR/html4/types.html#type-content-type


Any value would be legal HTML4.01, but the user agent would have to support it. It's much the same thing as specifying a script language - technically you could have anything, in reality only ecmascript/javascript has wide support.


The only valid value is text/css

  • http://www.w3schools.com/tags/tag_style.asp
  • http://www.ietf.org/rfc/rfc2318.txt


From what I know of "text/css" is the only style type you can have.

Source

Another Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜