文字の位置の指定

トップやさしいHTML教室トップメニュー>文字の位置の指定 次へ(セルの枠と文字との間隔の指定)

td align="位置"

セルの中の文字の横の位置を指定するには td align="位置"を使います。
位置のところには、左揃えの場合は left 、中央揃えの場合は center 、右揃えの場合は right を入力します。

td valign="位置"

セルの中の文字の縦の位置を指定するにはtd valign="位置"を使います。
位置のところには上揃えの場合が top 、中央揃えの場合は middle 、下揃えの場合は bottom を入力します。

プレビュー HTMLソース
サンプル
戻る 進む ホーム
あいうえお
あいうえお
あいうえお
<html>
<head>
<title>サンプル</title>
</head>
<body>

<table width="200"height="200"border="1">
<tr>
 <td align="left"valign="top">あいうえお</td>
</tr>
</table>

<table width="200"height="200"border="1">
<tr>
 <td align="right"valign="middle">あいうえお</td>
</tr>
</table>

<table width="200"height="200"border="1">
<tr>
 <td align="center"valign="bottom">あいうえお</td>
</tr>
</table>

</body>
</html>

トップやさしいHTML教室トップメニュー>文字の位置の指定 次へ(セルの枠と文字との間隔の指定)