CSS(スタイルシート)でデザインする

文字の色、背景色を指定する

ここで使うタグ

color : カラーコード ;

文字の色をしていする

background-color: カラーコード ;

文字の背景色をしていする

次に紹介する文字のタグは文字の色と文字の背景色の指定です。
まずは文字の色を変えていきましょう。
文字の色を変えるにはcolor : カラーコード ;を使います。
このページで文字の色の指定するのは
   <h1>、<h2>、<h3>です。
<h1>をcolor : #ffffff ; (白)
<h2>をcolor : #ffcc00 ; (オレンジ)
<h3>をcolor : #0000ff ; (青)
bonx-1にcolor : #ffffff ; (白)
に指定します。

???


背景に色をつけるのは「レイアウトをデザインする」でっも紹介しました、background-color:カラーコード;を使います。
ここで背景に色を指定するのは
.menubackground-color:#c0c0c0; (シルバー)を指定します。

???


ホームページ ソース
XHTML(HTML)

<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=shift_jis" />
<link rel="stylesheet" href="style.css" type="text/css" />
<title>タイトル</title>
</head&g;t

<body>
<div id="body">

<div id="box-1">
<h1>h1 サイトタイトル</h1>
ホームページの説明文 <br />
テキスト テキスト テキスト テキスト テキスト テキスト
</div>

<div id="box-2">
<div class="menu">メニュー</div>
<ul>
<li>ページ1</li>
<li>ページ2</li>
<li>ページ3</li>
<li>ページ4</li>
<li>ページ5</li>
</ul>
<div class="menu">メニュー</div>
<ul>
<li>ページ1</li>
<li>ページ2</li>
<li>ページ3</li>
<li>ページ4</li>
<li>ページ5</li>
</ul>

</div>

<div id="box-3">
<h2>h;2 ページタイトル</h2>
<p>テキスト テキスト (省略)</p>

<h3>h3 見出し</h3>
<p>テキスト テキスト (省略)</p>

<h3>h3 見出し</h3>
<p>テキスト テキスト (省略)</p>
</div>

<div id="box-4">
copyright (c) ~~~.com All right reserved.
</div>

</div>

</body>

</html>


CSS(スタイルシート)

#body {
      width :800px ;
      border: 1px solid #9acd32;
      }

#box-1 {
      border-bottom: 1px solid #9acd320;
      background-image: url("img/top.png");
      font-size : 10px ;
      color : #ffffff ;
      }

#box-2 {
      float : left;
      width :200px;
      font-size : 14px ;
      }

#box-3 {
      float : right;
      width :600px;
      }

#box-4 {
      clear: both;
      width: 800px;
      background-color : #9acd32;
      }

.menu {
      font-size : 15px ;
      background-color:#c0c0c0;
      }

h1 {
      font-size : 20px ;
      color : #ffffff ;
      }

h2 {
      font-size : 18px ;
      color : #ffcc00 ;
      }

h3 {
      font-size : 18px ;
      color : #0000ff ;
      }

inserted by FC2 system