[ MENU PAGE ]     Step [1〜3][4][5][6][8][ホームページのUL方法]
Step 7  テーブル(表)の制作
このStepではテーブルについて説明していきます。 まずテーブルと聞くと表などを想像しますが、このテーブルがページのレイアウト・デザインには欠かせないものです。 大げさかもしれませんが、テーブルだけでイメージを使わずに結構ステキなページも作れてしまいます。 是非、テーブルをマスターして、よりよいページ作りに役立てましょう。
サンプルページ
サンプルページStep 7

AAAAA
BBBBB
CCCCC
DDDDD
サンプルページのソース
<html>
<head>
<title>サンプルページ</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center"><font size="7" color="#0000FF">サンプルページStep 7 </font><br><br>
<table width="200" border="1" cellpadding="5" cellspacing="3" bordercolor="#FF0000" bgcolor="#FF0000">
<tr bgcolor="#FFFFFF">
<td>
<div align="center">AAAAA</div>
</td>
<td>
<div align="center">BBBBB</div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>
<div align="center">CCCCC</div>
</td>
<td>
<div align="center">DDDDD</div>
</td>
</tr>
</table>
</div>
</body>
</html>
ソースの説明
<table width="200" border="1" cellpadding="5" cellspacing="3" bordercolor="#FF0000" bgcolor="#FF0000">
テーブル幅200/テーブル線幅1/テーブル内余白5/テーブルセル間隔3/テーブル線・背景色「あか」
<tr bgcolor="#FFFFFF"> </tr>
テーブルセル1行背景色「しろ」   行数分<tr> </tr>があります。
<td> </td>
セル1つ(マス目1つ) セルの数分<td> </td>があります。
<div align="center">AAAAA</div>
AAAAAを中央揃え
サンプルページ2
サンプルページStep 7-2

AAA
BBB
CCC
DDD
EEE
サンプルページ2のソース
<html>
<head>
<title>サンプルページ</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center"><font size="7" color="#0000FF">サンプルページStep 7-2</font><br>
<br>
<table width="321" border="0" height="127" cellpadding="0" cellspacing="0">
<tr>
<td height="30" width="92" bgcolor="#6600FF">
<div align="center"><font color="#FFFFFF">AAA</font></div>
</td>

<td height="30" width="146" bgcolor="#33FFFF">
<div align="center">BBB</div>
</td>

</tr>
<tr>
<td height="72" width="92" bgcolor="#FF0000" valign="bottom">
<div align="center"><font color="#FFFFFF">CCC</font></div>
</td>

<td height="72" width="146" bgcolor="#CCFFCC" valign="top">
<div align="center">DDD</div>
</td>

</tr>
<tr bgcolor="#FFCC00">
<td height="32" colspan="2">
<div align="center">EEE</div>
</td>

</tr>
</table>
</div>
</body>
</html>
ソースの説明
<td height="30" width="92" bgcolor="#6600FF"><div align="center"><font color="#FFFFFF">AAA</font></div></td>

「AAA」のあるセルの高さ30/幅92/背景色「あお」/「AAA」の文字色「しろ」中央揃え

<td height="72" width="92" bgcolor="#FF0000" valign="bottom"><div align="center"><font color="#FFFFFF">CCC</font></div></td>
「CCC」のあるセルの高さ72/幅92/背景色「あか」/「CCC」の文字色「しろ」中央揃え
valign="bottom"はセル中の高さの位置   [bottom]=下 [middle]=中 [top]=上
<tr bgcolor="#FFCC00"><td height="32" colspan="2"><div align="center">EEE</div></td>
colspan="2"は横セル2つ分を1つに結合して使うことです。
サンプルページ3
サンプルページStep 7-3

AAA
BBB
CCC
DDD
サンプルページ3のソース
<html>
<head>
<title>サンプルページ</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center"><font size="7" color="#0000FF">サンプルページStep 7-3</font><br>
<br>
<table width="321" border="0" height="127" cellpadding="0" cellspacing="0">
<tr>
<td height="64" width="92" bgcolor="#6600FF">
<div align="center"><font color="#FFFFFF">AAA</font></div>
</td>

<td rowspan="2" height="102" bgcolor="#33FFFF">
<div align="center">BBB</div>
</td>

</tr>
<tr>
<td height="44" width="92" bgcolor="#FF0000">
<div align="center"><font color="#FFFFFF">CCC</font></div>
</td>

</tr>
<tr bgcolor="#FFCC00">
<td height="32" colspan="2">
<div align="center">DDD</div>
</td>

</tr>
</table>
</div>
</body>
</html>
ソースの説明
<td rowspan="2" height="102" bgcolor="#33FFFF"><div align="center">BBB</div></td>

rowspan="2"は縦セル2つ分を1つに結合して使うことです。


このソースコードを「コピー」&「ペースト」で実行してみてください。 同じ結果が得られるはずです。
イロイロ試してみましょう。
次のStepはテーブルでページレイアウトについて説明します。
[ Step 8へ ]
Copyright © 2000 asarinet,co.all rights reserved.