From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/css/string/index.html | 94 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 files/ja/web/css/string/index.html (limited to 'files/ja/web/css/string/index.html') diff --git a/files/ja/web/css/string/index.html b/files/ja/web/css/string/index.html new file mode 100644 index 0000000000..0f874eec29 --- /dev/null +++ b/files/ja/web/css/string/index.html @@ -0,0 +1,94 @@ +--- +title: +slug: Web/CSS/string +tags: + - CSS + - CSS データ型 + - Reference + - Web + - ウェブ + - レイアウト +translation_of: Web/CSS/string +--- +
{{CSSRef}}
+ +

<string>CSSデータ型で、一連の文字列を表します。文字列は {{CSSxRef("content")}}, {{CSSxRef("font-family")}}, {{CSSxRef("quotes")}} など、数々の CSS プロパティで使用されます。

+ +

構文

+ +

<string> データ型は任意の数の Unicode 文字を、二重引用符 (") 又は単一引用符 (') で囲んで構成します。

+ +

多くの文字は文字通りに表現されます。またすべての文字は、それぞれの16進数の Unicode コードポイントで表現することもできます。例えば、 \22 は二重引用符を表し、 \27 は単一引用符 (')、 \A9 は著作権記号 (©) を表します。

+ +

重要なことは、文字によっては他の方法として、バックスラッシュでエスケープすることもできます。これらには二重引用符で囲まれた文字列内で使われる二重引用符、単一引用符で囲まれた文字列内で使われる単一引用符、及びバックスラッシュ自身です。例えば、 \\ は単一のバックスラッシュを生成します。

+ +

改行文字を出力するには、 \A 又は \00000A のように改行文字としてエスケープする必要があります。しかし、改行を行の末尾の文字として \ でエスケープすると、コード内で文字列を複数行に渡らせることができます。

+ +
+

メモ: HTML エンティティ (&nbsp;&#8212; など) は、 CSS の <string> の中で使用することはできません。

+
+ +

+ +
/* 単純な文字列 */
+"This string is demarcated by double quotes."
+'This string is demarcated by single quotes.'
+
+/* 文字のエスケープ */
+"This is a string with \" an escaped double quote."
+"This string also has \22 an escaped double quote."
+'This is a string with \' an escaped single quote.'
+'This string also has \27 an escaped single quote.'
+"This is a string with \\ an escaped backslash."
+
+/* 文字列内の改行 */
+"This string has a \Aline break in it."
+
+/* 2行にわたる文字列 (これら二つの文字列は同じ出力になります) */
+"A really long \
+awesome string"
+"A really long awesome string"
+
+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('CSS3 Values', '#strings', '<string>')}}{{Spec2('CSS3 Values')}}CSS Level 2 (Revision 1)から重要な変更なし
{{SpecName('CSS2.1', 'syndata.html#strings', '<string>')}}{{Spec2('CSS2.1')}}明示的定義; Unicode の6桁エスケープ文字を許容
{{SpecName('CSS1', '', '<string>')}}{{Spec2('CSS1')}}暗黙的定義; Unicode の4桁エスケープ文字を許容
+ +

ブラウザーの互換性

+ + + +

{{Compat("css.types.string")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf