背景画像の貼り方
<style type="text/css"><!-- から
--></style> までは
<head></head>の中に記述すること
←背景画像
画面全体
<style type="text/css"><!--
body {
background:gray;}
--></style>
<body>
背景色⇒gray
背景画像が表示されない時に違和感が
ないように背景色と背景画像の色は近い色を
<style type="text/css"><!--
body {
background:gray url('背景画像のurl');}
--></style>
<body>
画面全体背景画像を指定
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') fixed;}
--></style>
<body>
画面全体背景画像を固定
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') repeat-x;}
--></style>
<body>
背景画像を
横に一列
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') repeat-x fixed;}
--></style>
<body>
背景画像を
横に一列
固定
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') repeat-x fixed bottom;}
--></style>
<body>
背景画像を
横に一列
固定
位置
top 上
center 真中
bottom 下
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') repeat-y;}
--></style>
<body>
背景画像を
縦に一列
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') repeat-y fixed;}
--></style>
<body>
背景画像を
縦に一列
固定
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') repeat-y fixed right;}
--></style>
<body>
背景画像を
縦に一列
固定
位置
left 左
center 真中
right 右
位置を指定して貼る
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') no-repeat;}
--></style>
<body>
背景画像を
繰り返さない
で貼る
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') no-repeat fixed;}
--></style>
<body>
背景画像を
繰り返さない
固定で貼る
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') no-repeat right bottom;}
--></style>
<body>
背景画像を
右の
下に貼る
<style type="text/css"><!--
body {
background:gray url('背景画像のurl') no-repeat right bottom fixed;}
--></style>
<body>
背景画像を
右の
下に
固定で貼る
left
center
right
top
center
bottom
この組み合わせで背景画像の位置を指定する
位置をパーセントやサイズでの指定も出来ます