TEXT FORMATTING

テキストの書式設定

This text is styled with some of the text formatting properties. The heading uses the text-align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified. The underline is removed from this colored "Try it Yourself" link.

テキストは、特定のテキスト書式設定プロパティを使用してスタイル設定されます。 見出しでは、text-align、text-transform、および color プロパティを使用します。 段落はインデントされ、整列され、指定された文字間隔が設定されます。 次に、この色から「セルフデコレーション」を試してみます。してみてください」 リンクからアンダースコアが削除されました。

自分で試してみてください

文字の色

color 属性は、テキストの色を設定するために使用されます。 色は次の値で指定されます。

  • 色の名前 - 例: "red"
  • 16 進値 - 例: "#ff0000"
  • RGB 値 - 例: "rgb(255,0,0)"

ページのデフォルトのテキストの色は本文セレクターで定義されます。

body {
  color: blue;
}

h1 {
  color: green;
}

自分で試してみてください

ヒント: W3C 準拠の CSS の場合: color 属性を定義する場合は、background-color も定義する必要があります。属性。

文字の色と背景の色

この例では、background-color 属性と color 属性を定義します。

body {
  background-color: lightgrey;
  color: blue;
}

h1 {
  background-color: black;
  color: white;
}

自分で試してみてください