From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../ja/web/css/_doublecolon_first-line/index.html | 121 +++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 files/ja/web/css/_doublecolon_first-line/index.html (limited to 'files/ja/web/css/_doublecolon_first-line') diff --git a/files/ja/web/css/_doublecolon_first-line/index.html b/files/ja/web/css/_doublecolon_first-line/index.html new file mode 100644 index 0000000000..ca36c8b9a0 --- /dev/null +++ b/files/ja/web/css/_doublecolon_first-line/index.html @@ -0,0 +1,121 @@ +--- +title: '::first-line (:first-line)' +slug: 'Web/CSS/::first-line' +tags: + - CSS + - Layout + - Pseudo-element + - Reference + - Selector +translation_of: 'Web/CSS/::first-line' +--- +
{{CSSRef}}
+ +

::first-lineCSS擬似要素で、ブロックレベル要素の最初の行にスタイルを適用します。なお、最初の行の長さは要素の幅、文書の幅、文字列のフォントの大きさなど、様々な要因に左右されます。

+ +
/* <p> の最初の行を選択 */
+p::first-line {
+  color: red;
+}
+ +
+

CSS3 では ::first-line という (二重コロン付き) 表記が、 擬似クラス擬似要素を見分けやすくするために導入されました。ブラウザーでは CSS2 で導入された :first-line も使用できます。

+
+ +

利用可能なプロパティ

+ +

::first-line 擬似要素では、一部の CSS プロパティのみが利用できます。

+ + + +

構文

+ +
{{csssyntax}}
+ +

+ +

HTML

+ +
<p>スタイルはこの段落の最初の行にのみ適用されます。
+その後のすべての文字列は普通のスタイルになります。分かりますか?</p>
+
+<span>ブロックレベル要素ではないので、この文字列の最初の行は、
+特殊なスタイルになりません。</span>
+ +

CSS

+ +
::first-line {
+  color: blue;
+  text-transform: uppercase;
+
+
+  /* 警告: これらを使用しないでください */
+  /* ::first-line 擬似要素では多くのプロパティが無効になります */
+  margin-left: 20px;
+  text-indent: 20px;
+}
+ +

結果

+ +

{{EmbedLiveSample('Examples', 350, 160)}}

+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('CSS4 Pseudo-Elements', '#first-line-pseudo', '::first-line')}}{{Spec2('CSS4 Pseudo-Elements')}}::first-letter を利用できる場所をもっと厳密に定義。
+ 利用できるプロパティを組版、文字装飾、インライン配置、 {{cssxref("opacity")}} に一般化。
+ ::first-letter の継承を定義。
{{SpecName('CSS3 Text Decoration', '#text-shadow-property', 'text-shadow with ::first-line')}}{{Spec2('CSS3 Text Decoration')}}::first-letter で {{cssxref("text-shadow")}} が使用できるようになった。
{{SpecName('CSS3 Selectors', '#first-line', '::first-line')}}{{Spec2('CSS3 Selectors')}}擬似要素用の二重コロン構文の導入。
{{SpecName('CSS2.1', 'selector.html#first-line-pseudo', '::first-line')}}{{Spec2('CSS2.1')}}変更なし。
{{SpecName('CSS1', '#the-first-line-pseudo-element', '::first-line')}}{{Spec2('CSS1')}}初回定義、単一コロン構文を使用。
+ +

ブラウザーの互換性

+ +
+ + +

{{Compat("css.selectors.first-line")}}

+
+ +

関連情報

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