|
■ 背景画像を左上に固定させる |
これはスタイルシートを使います。難しいので左上の固定のさせ方だけ説明いたします。
詳しくはスタイルシート講座サイトを参照ください。 |
<STYLE TYPE="text/css"><!--
BODY{
background-image : url(☆);
background-attachment: fixed;
background-position: left top;
background-repeat: no-repeat
}
--></STYLE>
☆=画像ファイル名 |
<html>
< head>
<
title>背景スタイルシート</title>
< /head>
<
STYLE TYPE="text/css"><!--
BODY{
background-image : url(cake.jpg);
background-attachment: fixed;
background-position: left top;
background-repeat: no-repeat
}
--></STYLE>
< body>
< /body>
< /html> |
|
■ 背景設定速見表 |
[ background-repeat: no-repeat ]部分
繰り返し
repeat
縦横に背景画像を繰り返して表示します。*1
repeat-x
横方向にのみ背景画像を繰り返して表示します。
repeat-y
縦方向にのみ背景画像を繰り返して表示します。
no-repeat
背景画像を一回だけ表示して繰り返しません。 |
*無記入の時の初期設定
[ background-position: left top ]部分 位置指定
横方向 |
left(左)
|
center(中央) |
right(右) |
縦方向 |
top(上) |
center(中央) |
bottom(下) |
[ background-attachment: fixed ]部分 画像固定
fixed *1
背景画像の位置が固定され、スクロールしても動かなくなります。
scroll
スクロールに伴って、背景画像も移動します。 |
|
|
|