サイト内検索
...スタイルシート(css)...
スタイルシート・水平線
背景画の指定
- 画像は、background-imageプロパティを指定します。
- [使い方]
- hr.sample{
width: 70%;
height: 20px;
background-image: url(../img/sample.gif);
}
- 外部ファイルで画像を表示させる場合
- 画像の外部スタイルシートファイル(.css)から見た
- 画像ファイルの相対アドレス(url)を記述します。
プロパティ名 | 値 | 説明 |
---|---|---|
background-image: | ; |
「url(http://・・/sample.jpg);」
のように表示する画像(URL)を指定します。 |
サンプル
[headの中]
<style type="text/css"><!--
hr.sample1{
width: 70%;
height: 20px;
background-image: url(../img/sample.gif);
}
hr.sample2{
width: 70%;
height: 20px;
background-image: url(../img/sample.gif);
background-color: #ffff8e;
background-repeat: no-repeat;
background-position: center;
}
-->
</style>
[bodyの中]
<hr class="sample1"><hr class="sample2">
[ブラウザ上]