satoshiabe.jp : VALID HTML
HOME > DOCUMENTS > VALID HTML
まえがき
自分が、Valid な HTML ページを作成する際に、よく忘れてしまうことをメモしているページ。
サンプル
XHTML version
<?xml version="1.0" encoding="utf-8" ?> <!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=utf-8" /> <link rel="stylesheet" href="./css/design.css" type="text/css" /> <title>title</title> <meta http-equiv="description" content="ページの説明" /> <meta name="keywords" content="キーワード" /> <link rev="made" href="mailto:webmaster@example.com" /> <link rel="start" href="http://www.example.com/" /> <link rel="contents" href="./index.html" /> </head> <body> </body> </html>
HTML version
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=EUC-JP"> <title<title>/title> </head> <body> hogehoge </body> </html>
1 行目
XHTML 作成したファイルの文字コードが UTF-8 ではなかったら 1 行目に記述する。 尚、UTF-8 でも記述しておいて害はない。
<?xml version="1.0" encoding="UTF-8" ?>
charset を指定する
対、Internet Explorer 用。
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
DTD を宣言する
W3C のページを参考にする
W3C QA - Recommended list of DTDs you can use in your Web document.
外部スタイルシートのファイルへのリンク
以下のように head 内に記述する。
<link rel="stylesheet" href="./css/design.css" type="text/css" />
/
最後に / を記述する。 他にもある。
<br /> <img src="hoge.png" alt="hoge image" /> <link rev="made" href="mailto:webmaster@satoshiabe.jp" />
img
alt 属性で画像の説明を記述する。
<img src="image.png" alt="hoge image">
特殊文字
以下の特殊文字に注意する。
記述する文字 : 表示される文字 ------------------------------ & : & < : < > : >
Do NOT use
使用しない方が良い属性の一部。 スタイルシートで置き換える。
align
alink
background
ibgcolor
border
clea
compact
height
hspace
language
link
noshade
nowrap
size
start
text
type
value
version
vlink
vspae
width
Validater
W3C THML, CSS Validater を利用する
The W3C Markup Validation Service
よく参考にする Web サイト