Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ 背景画像の適用 | 装飾的およびモダンな効果
CSSの基礎

book背景画像の適用

メニューを表示するにはスワイプしてください

background-image プロパティは、HTML要素の背景として画像を追加するために使用。基本的な構文は非常にシンプル:

background-image: url("image-url.jpg");

background-image プロパティの値として url() を使用し、この括弧内に画像のURLを指定。

index.html

index.html

index.css

index.css

copy

background-repeat

画像を水平方向、垂直方向、両方、または繰り返さないかを決定。

background-repeat: repeat | repeat-x | repeat-y | no-repeat;
index.html

index.html

index.css

index.css

copy

background-position

background-position は、要素の背景領域内で背景画像の開始位置を設定するプロパティ。 このプロパティにより、背景画像をどこに配置し、要素に対してどのように位置付けるかを指定可能。 x 軸と y 軸で位置を設定。

background-position: x y
index.html

index.html

index.css

index.css

copy

background-size

背景画像の拡大・縮小方法の制御:

background-size: auto | cover | contain | value in px/em/rem;
  • auto: 元の画像サイズ;
  • cover: 要素全体を埋める(画像が切り取られる場合あり);
  • contain: 画像全体を収める(空白ができる場合あり);
  • value: カスタムサイズ(例:100px50px50%)。
index.html

index.html

index.css

index.css

copy

1. background-image プロパティの役割は何ですか?

2. background-repeat プロパティの役割は何ですか?

3. 要素の背景画像の位置を決定するプロパティはどれですか?

question mark

background-image プロパティの役割は何ですか?

正しい答えを選んでください

question mark

background-repeat プロパティの役割は何ですか?

正しい答えを選んでください

question mark

要素の背景画像の位置を決定するプロパティはどれですか?

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 5.  2

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 5.  2
some-alt