HTML TIPS

※ ここに記されているのは私の覚え書きです。
※ 内容の正しさについては保証しません(出来ません)。
※ 参考にする場合は自己責任でお願いします。

XHTML 1.0 Strict テンプレート

<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="content-type" content="text/html; charset=Shift_JIS" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-style-type" content="text/css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" href="favicon.ico" />
<title>タイトル</title>
</head>
<body>

<!-- 本文 -->

</body>
</html>

HTML 4.01 Strict テンプレート

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="shortcut icon" href="favicon.ico">
<title>タイトル</title>
</head>
<body>

<!-- 本文 -->

</body>
</html>

HTML 4.01 Transitional テンプレート

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
(以下、HTML 4.01 Stricと同じ)

HTML 4.01 Frameset テンプレート

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
<title>タイトル</title>
</head>
<frameset cols="*,*" title="title">
<!-- 横分割の場合はrows -->
<frame src="frame1.html" name="frame1" title="frame1">
<frame src="frame2.html" name="frame2" title="frame2">
<noframes>
<body>

<!-- フレーム非対応環境用への代替内容 -->

</body>
</noframes>
</frameset>
</html>

CSSでhrのnoshadeの表現例

hr {
border:0px none #000000;
height:1px;
color:#000000;
background-color:#000000;
}

CSSでのブロック要素のセンタリング

■IEのバグを考慮しない場合
<div style="width:xx;margin-right:auto;margin-left:auto;">
  ブロック要素
</div>

■IEのバグを考慮した場合
<div style="text-align:center;">
 <div style="width:xx;margin-right:auto;margin-left:auto;text-align:left;">
  ブロック要素
 </div>
</div>

■右揃えの場合
<div style="width:xx;margin-left:auto;">
  ブロック要素
</div>

XHTMLの留意点

全てのタグは小文字で記述する
空要素のタグは /> で閉じる(br、hrなど)
終了タグを省略しない(p、liなど)
属性の値は必ず引用符("属性")で囲む
name属性にはid属性を併記する
&はあらゆるところで&amp;と記述する
スクリプトは外部ファイルに記述するのが好ましい
スタイルシートは外部ファイルに記述するのが好ましい

戻る