.css

MIME 型 text/css

[1] text/css は、CSSMIME型です。

引数

[6] charset引数があります >>4charset 引数は必須ではありません >>4。明記されていませんが text/* の共通の charset 引数の定義によるものと思われます。

[7] この引数の値を使って復号する処理は CSS Syntax Module Level 3 ( 版) http://dev.w3.org/csswg/css-syntax/#input-byte-stream で規定されています。 charset 名は Encoding Standard により解釈されます。

[8] CSS の構文が US-ASCII であり、 charsetUS-ASCII超集合であればよいと >>4 には記述されています。ここでいう「超集合」が何かは不明瞭ですが、 ISO-8859-1 のような US-ASCII の単純な拡張の他、 Shift_JIS のように ASCII 領域が US-ASCII と異なるもの、 ISO-2022-JP のように ASCII 領域が別の意味に解釈される場合もあるもの、 UTF-16 のように8ビット符号ですらないものなど様々な charset が現実には用いられています。 >>7 では Encoding Standard を参照しています。
[9] >>6 の推測 (MIMEcharset の定義の援用) と >>7Encoding Standard に基づく解釈は、厳密には異なります。現実の Web の世界での解釈に近いのは >>7 です。

実装

[3] 実世界では CSS スタイル・シートであっても text/css と正しく札付けされていないことがあります。 Gecko無奇癖モードでは text/css とされていないスタイル・シートは無視しますが、 そのように仕様変更がなされた時以来、 Gecko でだけ正しくレンダリングされない現象が多発しています。 これは HTTP における媒体型の仕組みの失敗を象徴する事例の1つです。

拡張子

[10] 拡張子としては .css が用いられます。 >>4

Macintosh ファイル型

[11] Macintoshファイル型としては css (4文字目は SPACE) が用いられます。 >>4

[12] 実際には TEXT が用いられることが多かったのではないでしょうか。

関連

[2]text/css」は CSS を表すインターネット媒体型 (MIME型) ですが、 CSS媒体照会で使われる「媒体型」とは関係がありません。

歴史

RFC 2318

原文 >>4 + 和訳

The text/css Media Type text/css media type

  • Network Working Group
  • Request for Comments: 2318
  • Category: Informational
  • H. Lie
  • B. Bos
  • C. Lilley
  • W3C
  • March 1998

Status of this Memo

This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited.

Copyright Notice

Copyright (C) The Internet Society (1998). All Rights Reserved.

Abstract 概要

Cascading Style Sheets (CSS) is a style sheet language for the World Wide Web. CSS style sheets have been in use since October 1995 using the Media Type text/css without registration; this memo seeks to regularize that position.

cascading style sheet

は1995年10月より登録無しでmedia type text/css を使ってきました。このメモはその立場を正当化します。

1. Introduction はじめに

The World Wide Web Consortium has issued a Recommendation [1], which defines Cascading Style Sheets, level 1. This memo provides information about the text/css Media Type.

[11] World Wide Web Consortiumcascading style sheets水準1を定義するRecommendation [>>1] を発行しました。 このメモは text/css media typeについての情報を提供します。

2. Cascading Style Sheets cascading style sheets

Cascading Style Sheets (CSS) is a style sheet language for the World Wide Web. It describes the presentation (e.g. fonts, colors and spacing) of structured documents. CSS is human readable and writable, and expresses style in common desktop publishing terminology.

[12] cascading style sheets (CSS) はWorld Wide Web向けのstyle sheet言語です。 CSS は構造化文書の表現 (例えばfont, 色や間隔) を記述します。 CSS は人間が読み書きでき、 共通のdesktop publishing用語でstyleを表現します。

CSS style sheets have been in use since October 1995 using the Media Type text/css without registration; this memo seeks to regularize that position.

CSS style sheetは1995年10月から登録無しにmedia type text/css を使ってきました。 このメモはその立場を正当化しようとするものです。

A CSS style sheet can be either:

CSS style sheetは、

(1) external - the style sheet is linked to a document through a URI and exists as a separate object on the Web. The media type text/css is used when fetching the object, for example in the Content-Type and Accept header fields of HTTP [2].

一、外部: style sheetは URI を使って文書にlinkされ、Webで異なるobjectとして存在する。 media type text/cssobjectを取り寄せる時に、例えば HTTPContent-TypeAcceptheaderfieldで使う。

(2) internal - the style sheet is contained within the document. A typical scenario is an HTML [3] document that contains a style sheet within the STYLE element. Due to this close relationship, HTML and CSS share the same top-level name ("text").

二、内部: style sheetは文書中に含まれる。 典型的には、 STYLE element中にstyle sheetを含む HTML [>>3] 文書。この密接な関係のために、 HTML と CSS は共に同じtop level名 ("text") を共有しています。

訳注: ほんとかよ?

のいずれかです。

4. Registration Information 登録情報

       To: ietf-types@iana.org
       Subject: Registration of MIME media type text/css
       MIME media type name: text
       MIME subtype name: css
       Required parameters: none
       Optional parameters: charset
       The syntax of CSS is expressed in US-ASCII, but a CSS file can
       contain strings which may use any Unicode character. Any charset
       that is a superset of US-ASCII may be used; US-ASCII, iso-8859-X
       and utf-8 are recommended.

CSS の構文は US-ASCII で表現しますが、 CSS fileに含まれる文字列はどの Unicode 文字をも含めることが出来ます。 US-ASCII の上位集合であるどんな charset でも使って構いません。 US-ASCII, iso-8859-X, utf-8 を推奨します。

   Encoding considerations:
       For use with transports that are not 8-bit clean, 
       quoted-printable encoding is recommended since the majority of
       characters will be CSS syntax and thus US-ASCII
8-bit clean

でない転送路で使う時には、文字の大部分は CSS 構文であることから US-ASCII なので、 quoted-printable 符号化を推奨します。

   Security considerations:
       Applying a style sheet to a document may hide information
       otherwise visible. For example, a very small font size may be
       specified, or the display of certain document elements may be
       turned off.

文書にstyle sheetを適用することで、そうしなければ見えていた情報を隠してしまうかもしれません。 例えば、非常に小さいfont sizeが指定されているかもしれませんし、 ある文書要素の表示をしないようにしているかもしれません。

       CSS style sheets consist of declarative property/value pairs
       assigned to element selectors. They contain no executable code.

CSS style sheetelementselectorに割当てられたproperty・値の組の宣言で構成します。

       As with HTML documents, CSS style sheets may contain links to
       other media (images, sounds, fonts, other style sheets) and those
       links are typically followed automatically by software, resulting
       in the transfer of files without the explicit request of the user
       for each one. The security considerations of each linked file are
       those of the individual registered types.

HTML 文書と併用することで、 CSS style sheetは他のmedia (画像, 音声, font, 他のstyle sheet) へのlinkを含めることが出来て、そうしたリンクは典型的にソフトウェアにより自動的に辿られるようになっており、 結果として利用者が陽に要求することなしにfileが転送されることになります。 各被linkfileの安全性についてはそれぞれの登録型のものです。

   Interoperability considerations:
       CSS has proven to be widely interoperable across computer
       platforms, across Web browsers of different makes, and for import
       and export in multiple authoring tools.

CSS は計算機platform, 異なる作りのWebbrowser, 複数のauthoring toolの入出力を越えて広く相互運用可能であることが証明されています。

   Published specification: see [1]
   Applications which use this media type:

このmedia typeを使う応用:

       CSS is device-, platform- and vendor-neutral and is supported by
       a wide range of Web user agents and authoring tools for
       formatting HTML and XML documents.

CSS は機器・platform・販売者に対して中立であり、 広範囲のWebuser agent及びauthoring toolが HTML や XML の文書を整形するのに対応しています。

   Additional information:
       Magic number(s): none
       File extension(s): .css
       Macintosh File Type Code(s): "css "
       Object Identifier(s) or OID(s): none
   Person & email address to contact for further information:
       The authors of this memo.
   Intended usage: COMMON
     Author/Change controller:

5. References 参考文献

[1] Lie, H., and B. Bos, "Cascading Style Sheets, level 1", W3C Recommendation REC-CSS1-961217, http://www.w3.org/TR/REC-CSS1-961217, December 1996.

[2] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2068, January 1997.

[3] Raggett, D., Le Hors, A. and I. Jacobs, "HTML 4.0 Specification", W3C Recommendation REC-html40-971218, http://www.w3.org/TR/REC-html40, December 1997.

6. Authors' Addresses

   Hakon Lie
   W3C/INRIA
   2004, route des Lucioles - B.P. 93
   06902 Sophia Antipolis Cedex
   FRANCE
   Phone: +33 (0)492387771
   Fax:   +33 (0)493657765
   EMail: howcome@w3.org
   Bert Bos
   2004, route des Lucioles - B.P. 93
   06902 Sophia Antipolis Cedex
   FRANCE
   Phone: +33 (0)492387692
   Fax:   +33 (0)493657765
   EMail: bert@w3.org
   Chris Lilley
   2004, route des Lucioles - B.P. 93
   06902 Sophia Antipolis Cedex
   FRANCE
   Phone: +33 (0)492387987
   Fax:   +33 (0)493657765
   EMail: chris@w3.org

[16] このメモが参照している HTTP/1.1 の仕様書、 RFC2068 は、後に RFC2616 に改訂されました。

[17] このメモが参照している HTML4.0 は、 後に HTML4.01 に改訂されました。

[18] このメモは CSS1 を参照していますが、 既に CSS2 も規定されています。

[13] Fold request type into destination (annevk著, ) https://github.com/whatwg/fetch/commit/d7052e2b6d24d04caa2cea8ef664923ecdb1e35c

[14] Improve <style> and <script> processing and conformance (domenic著, ) https://github.com/whatwg/html/commit/9c612ac8641b5174849a2d3cb924fe662a8d3a09

[15] 788096 - CSS should be restricted to reasonable MIME types in quirks mode. - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=788096