当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

「HTML to XHTML」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(原文リンクを追加、英語を最新版に更新。)
(見出しを和訳。本文は「XHTML と HTML の違い」節まで和訳。)
1行目: 1行目:
{{NeedTrans}}
+
{{NeedTrans|「[[#So_how_do_I_write_XHTML.3F|XHTML の書き方]]」節以降が}}
==What is and what isn't XHTML==
+
[[Category:未翻訳]]
WordPress, as a system, is based on documents written in the XHTML scripting language. XHTML 1.0 (which is currently the most widely supported version and stands for eXtensible Hyper Text Markup Language) became a W3C recommendation in the year 2000, and was intended to serve as an interim technology until XHTML 2.0 could be finalized. Eight years later XHTML 2.0 still isn't finished. This document therefore uses the phrase XHTML to refer to XHTML 1.0 only.
+
  
XHTML is very similar to HTML as both are descendants of a language called SGML. However, XHTML is also descended from XML, which is a scripting language with much stricter grammar rules than HTML, and XHTML has inherited some of that discipline. XHTML is mainly differentiated from HTML by its use of a new MIME TYPE and the addition of some new syntax rules which are explained below.
+
== XHTML は何であり何でないか<span id="What_is_and_what_isn.27t_XHTML"></span> ==
  
==Why Should I use XHTML==
+
システムとしての WordPress XHTML スクリプト言語で書かれた文書に基づいています。XHTML 1.0 (現在最も広くサポートされているバージョン。eXtensible Hyper Text Markup Language、拡張可能なハイパーテキストマークアップ言語の略) が W3C の推奨になったのは西暦2000年で、XHTML 2.0 が標準化されるまでの中継ぎとされていました。しかし8年が過ぎても XHTML 2.0 は標準になっていません (訳注: 2009年に策定が打ち切られました)。この文書では XHTML という用語を XHTML 1.0 を指すものとして使います。
WordPress prints XHTML from all its internal functions, all themes therefore are now in XHTML and so too are most plugins. So, if you want to use WordPress, you should buckle down and learn some XHTML as that's where it is right now.
+
  
==What are the differences between XHTML and HTML==
+
XHTML はどちらも SGML と呼ばれた言語の後継である点で HTML にとてもよく似ています。しかし XHTML は、HTML よりもっと厳格な構文規則を持つスクリプト言語 XML の後継でもあり、その規則の一部を受け継いでいます。主に新しい MIME タイプの使用と新しい文法の追加という点で、XHTML は HTML と異なっています。以下にそれらの差異を説明します。
If you are familiar with HTML, you will be glad to know that the majority of what you know about HTML is still relevant in XHTML. The main differences are that XHTML forces webpage authors to be more consistent and to write more legible code. There are a few syntax and grammar differences and a few HTML tags have been dropped and, really, that's about it. If you know HTML then you'll be surprised at how easy it is to switch to XHTML, and the new XHTML rules will force you to become a better programmer too!
+
  
==So how do I write XHTML?==
+
== XHTML を使う理由<span id="Why_Should_I_use_XHTML"></span> ==
 +
 
 +
WordPress はすべての内部関数から XHTML を出力します。そのためすべてのテーマと、大部分のプラグインも同様に XHTML を出力します。ですから WordPress を使いたいなら、今こそが XHTML に取り組み学ぶべき時です。
 +
 
 +
== XHTML と HTML の違い<span id="What_are_the_differences_between_XHTML_and_HTML"></span> ==
 +
 
 +
HTML に慣れているなら、HTML の知識の大部分が XHTML でも通用することにホッとするでしょう。主な違いは、XHTML を使う Web ページ作者は従来よりも一貫性があり読みやすいコードを書く必要がある点です。しかし構文と文法に幾つか違いがあり、一部の HTML タグが廃止された、その程度です。<!-- There are a few syntax and grammar differences and a few HTML tags have been dropped and, really, that's about it. -->HTML を知っていれば XHTML への乗り換えの容易さに驚くでしょう。そして XHTML の新しい規則はあなたを良いプログラマーに育てるでしょう !
 +
 
 +
== XHTML の書き方<span id="So_how_do_I_write_XHTML.3F"></span> ==
  
 
Well, here's a quick check list of the important requirements of XHTML and the differences between it and HTML. This is NOT a comprehensive XHTML language reference. [http://www.w3.org/TR/xhtml1/ Please look here for that.]
 
Well, here's a quick check list of the important requirements of XHTML and the differences between it and HTML. This is NOT a comprehensive XHTML language reference. [http://www.w3.org/TR/xhtml1/ Please look here for that.]
17行目: 22行目:
 
<em>In these examples some code has been omitted for clarity</em>
 
<em>In these examples some code has been omitted for clarity</em>
  
===All tags, attributes and values must be written in lowercase.===
+
=== タグ、属性、値をすべて必ず小文字で書く<span id="All_tags.2C_attributes_and_values_must_be_written_in_lowercase."></span> ===
Right:  
+
 
 +
正しい例:  
 
  &lt;a href="www.kilroyjames.co.uk" &gt;
 
  &lt;a href="www.kilroyjames.co.uk" &gt;
  
Wrong:  
+
間違った例:  
 
  &lt;A HREF="www.kilroyjames.co.uk" &gt;
 
  &lt;A HREF="www.kilroyjames.co.uk" &gt;
  
===All attribute values must be within quotes===
+
=== 属性値を必ずクォートで囲む<span id="All_attribute_values_must_be_within_quotes"></span> ===
Right:  
+
 
 +
正しい例:  
 
  &lt;a href="www.kilroyjames.co.uk"&gt;
 
  &lt;a href="www.kilroyjames.co.uk"&gt;
Wrong:  
+
間違った例:  
 
  &lt;a href=www.kilroyjames.co.uk&gt;
 
  &lt;a href=www.kilroyjames.co.uk&gt;
  
===All tags must be properly nested===
+
=== タグの入れ子を正しく<span id="All_tags_must_be_properly_nested"></span> ===
Right:  
+
 
 +
正しい例:  
 
  &lt;em&gt;this emphasis just keeps getting &lt;strong&gt;stronger and stronger&lt;/strong&gt;&lt;/em&gt;
 
  &lt;em&gt;this emphasis just keeps getting &lt;strong&gt;stronger and stronger&lt;/strong&gt;&lt;/em&gt;
Wrong:  
+
間違った例:  
 
  &lt;em&gt;this emphasis just keeps getting &lt;strong&gt;stronger and stronger&lt;/em&gt;&lt;/strong&gt;
 
  &lt;em&gt;this emphasis just keeps getting &lt;strong&gt;stronger and stronger&lt;/em&gt;&lt;/strong&gt;
  
===All XHTML documents must carry a DOCTYPE definition===
+
=== XHTML 文書に必ず DOCTYPE 定義を付ける<span id="All_XHTML_documents_must_carry_a_DOCTYPE_definition"></span> ===
 +
 
 
The DOCTYPE is an intimidating looking piece of code that must appear at the start of every XHTML document, it tells the browser how to render the document.
 
The DOCTYPE is an intimidating looking piece of code that must appear at the start of every XHTML document, it tells the browser how to render the document.
  
54行目: 63行目:
 
Note: you might have a problem getting WordPress to validate as Strict because, as of version 2.6.2, some of the internally generated &lt;form&gt; elements still use the "name" attribute, which is not allowed under the Strict DTD, ie. &lt;input name="my_button" /&gt;
 
Note: you might have a problem getting WordPress to validate as Strict because, as of version 2.6.2, some of the internally generated &lt;form&gt; elements still use the "name" attribute, which is not allowed under the Strict DTD, ie. &lt;input name="my_button" /&gt;
  
Note also that using a Transitional DTD takes most browsers out of "Standards" mode. It is much trickier to get your web pages to look consistent across different browsers when the browsers are not in Standards mode. I'm not going to explain the minutae of the DOCTYPE tag as it gets deeper and more complicated, just know that for best results you should use one of the following, preferably the first one (Strict):
+
Note also that using a Transitional DTD takes most browsers out of "Standards" mode. It is much trickier to get your web pages to look consistent across different browsers when the browsers are not in Standards mode. I'm not going to explain the minutiae of the DOCTYPE tag as it gets deeper and more complicated, just know that for best results you should use one of the following, preferably the first one (Strict):
  
 
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <br/>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
 
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <br/>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
60行目: 69行目:
 
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <br/>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
 
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <br/>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
===The HTML tag must contain an XMLNS attribute===
+
=== HTML タグに必ず XMLNS 属性を含める<span id="The_HTML_tag_must_contain_an_XMLNS_attribute"></span> ===
 +
 
 
You don't need to understand the "XML namespace" attribute, except to know that it is required in all XHTML documents. Here is an example of how to write it:
 
You don't need to understand the "XML namespace" attribute, except to know that it is required in all XHTML documents. Here is an example of how to write it:
 
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
 
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
===Documents must be properly formed with HTML, HEAD, TITLE and BODY tags===
+
=== HTML, HEAD, TITLE および BODY タグを使った適切な形式の文書<span id="Documents_must_be_properly_formed_with_HTML.2C_HEAD.2C_TITLE_and_BODY_tags"></span> ===
 +
 
 
In HTML it is possible to write a webpage that contains none of the above tags; in XHTML it is not. The above tags must be included and they must be nested and ordered correctly, as follows (the DOCTYPE has been omitted):
 
In HTML it is possible to write a webpage that contains none of the above tags; in XHTML it is not. The above tags must be included and they must be nested and ordered correctly, as follows (the DOCTYPE has been omitted):
  
79行目: 90行目:
 
  &lt;/html&gt;
 
  &lt;/html&gt;
  
===All tags must be closed, even single tags===
+
=== 独立タグでも必ず正しく閉じる<span id="All_tags_must_be_closed.2C_even_single_tags"></span> ===
  
 
  &lt;p&gt;Mary had a little lamb
 
  &lt;p&gt;Mary had a little lamb
105行目: 116行目:
 
This is correct XHTML.
 
This is correct XHTML.
  
===Attribute minimisation isn't allowed===
+
=== 属性の最小化は禁止<span id="Attribute_minimisation_isn.27t_allowed"></span> ===
 +
 
 
In HTML, attributes can be strung together almost like they were keywords, ie. &lt;dl compact&gt;, this is called attribute minimisation.
 
In HTML, attributes can be strung together almost like they were keywords, ie. &lt;dl compact&gt;, this is called attribute minimisation.
 
In XHTML that is not allowed, attributes and values must be explicit, ie.  
 
In XHTML that is not allowed, attributes and values must be explicit, ie.  
 
  &lt;dl compact="compact"&gt;
 
  &lt;dl compact="compact"&gt;
  
===ID and NAME attributes===
+
=== ID および NAME 属性<span id="ID_and_NAME_attributes"></span> ===
 +
 
 
In HTML it was legal to use ID and NAME attributes interchangeably. In XHTML the NAME attribute is formally deprecated and cannot be used. In all cases where you would think to use a NAME attribute you must now use ID instead. e.g.
 
In HTML it was legal to use ID and NAME attributes interchangeably. In XHTML the NAME attribute is formally deprecated and cannot be used. In all cases where you would think to use a NAME attribute you must now use ID instead. e.g.
  
118行目: 131行目:
 
  &lt;input type="submit" id="s" value=" Search " /&gt;
 
  &lt;input type="submit" id="s" value=" Search " /&gt;
  
===STYLE is all in your HEAD===
+
=== STYLE はすべて HEAD に入れる<span id="STYLE_is_all_in_your_HEAD"></span> ===
 +
 
 
XHTML does not allow STYLE declarations within the body of a document they must be placed in the document HEAD instead.
 
XHTML does not allow STYLE declarations within the body of a document they must be placed in the document HEAD instead.
  
===Entity references===
+
=== エンティティ参照<span id="Entity_references"></span> ===
 +
 
 
Write all literal ampersands as &amp;amp; or they will be assumed to be part of an entity reference. e.g. &amp;reg; is the entity reference for the symbol &reg;. Therefore M&amp;S is invalid XHTML because &amp;S is not an entity reference, you must write it as M&amp;amp;S.
 
Write all literal ampersands as &amp;amp; or they will be assumed to be part of an entity reference. e.g. &amp;reg; is the entity reference for the symbol &reg;. Therefore M&amp;S is invalid XHTML because &amp;S is not an entity reference, you must write it as M&amp;amp;S.
  
==Conclusion==
+
== まとめ<span id="Conclusion"></span> ==
 +
 
 
As was previously mentioned, this is not a comprehensive reference but it should be enough to get you up and running with XHTML pretty quickly. Good luck!
 
As was previously mentioned, this is not a comprehensive reference but it should be enough to get you up and running with XHTML pretty quickly. Good luck!
  
==Problems with XHTML==
+
== XHTML の問題点<span id="Problems_with_XHTML"></span> ==
 +
 
 
Most people don't realise that to use XHTML properly it must be served using the new MIME TYPE "application/xhtml+xml".  
 
Most people don't realise that to use XHTML properly it must be served using the new MIME TYPE "application/xhtml+xml".  
 
A MIME TYPE is simply a description that the web server sends to a browser to tell it what sort of document is coming. For instance a JPG image is sent with a MIME TYPE of "image/jpeg" and an HTML document with a MIME TYPE of "text/html".
 
A MIME TYPE is simply a description that the web server sends to a browser to tell it what sort of document is coming. For instance a JPG image is sent with a MIME TYPE of "image/jpeg" and an HTML document with a MIME TYPE of "text/html".
 
Sending an XHTML document with a MIME TYPE of "text/html" results in the document being parsed and validated as HTML, not as you would no doubt hope, as XHTML. You must use the correct MIME TYPE if you want to use XHTML otherwise you are simply using non-standard HTML. In order to avoid this problem and output standards compliant code you can use the [http://www.kilroyjames.co.uk/2008/07/xhtml-to-html-wordpress-plugin XHTML to HTML wordpress plugin].
 
Sending an XHTML document with a MIME TYPE of "text/html" results in the document being parsed and validated as HTML, not as you would no doubt hope, as XHTML. You must use the correct MIME TYPE if you want to use XHTML otherwise you are simply using non-standard HTML. In order to avoid this problem and output standards compliant code you can use the [http://www.kilroyjames.co.uk/2008/07/xhtml-to-html-wordpress-plugin XHTML to HTML wordpress plugin].
  
==HTML5==
+
== HTML5 ==
 +
 
 
Because of seemingly intractable problems with the development of XHTML (mainly that XHTML 2 is incompatible with previous versions of XHTML and HTML and also the MIME TYPE issue), a competing standard supported by Mozilla (Firefox), Apple (Safari), Opera, Microsoft (Internet Explorer) and some other key Internet players has become the new favourite to succeed the old HTML 4.01 standard.  
 
Because of seemingly intractable problems with the development of XHTML (mainly that XHTML 2 is incompatible with previous versions of XHTML and HTML and also the MIME TYPE issue), a competing standard supported by Mozilla (Firefox), Apple (Safari), Opera, Microsoft (Internet Explorer) and some other key Internet players has become the new favourite to succeed the old HTML 4.01 standard.  
  
 
HTML5 was passed as a working draft by the W3C in January 2008 and became a candidate recommendation in December 2012.
 
HTML5 was passed as a working draft by the W3C in January 2008 and became a candidate recommendation in December 2012.
  
==Resources==
+
== 関連項目<span id="Resources"></span> ==
  
 
* [http://www.w3.org/TR/xhtml1/ W3C XHTML language specification]
 
* [http://www.w3.org/TR/xhtml1/ W3C XHTML language specification]
 
* [http://validator.w3.org The W3Cs Markup Validation Service (use it!)]
 
* [http://validator.w3.org The W3Cs Markup Validation Service (use it!)]
* [http://en.wikipedia.org/wiki/XHTML  Wikipedia: XHTML ]
+
* [https://en.wikipedia.org/wiki/XHTML  Wikipedia: XHTML ]
* [http://en.wikipedia.org/wiki/XHTML#Common_errors  Wikipedia - Common XHTML errors ]
+
* [https://en.wikipedia.org/wiki/XHTML#Common_errors  Wikipedia - XHTML のよくある間違い ]
* [http://en.wikipedia.org/wiki/HTML_5  Wikipedia: HTML 5]
+
* [https://en.wikipedia.org/wiki/HTML_5  Wikipedia: HTML 5]
 
* [http://www.webdevout.net/articles/beware-of-xhtml Beware of XHTML]
 
* [http://www.webdevout.net/articles/beware-of-xhtml Beware of XHTML]
  
[[Category:未翻訳]]
+
[[Category:初心者向けトピック]]
[[Category:Getting_Started]]
+
 
[[Category:WordPress レッスン]]
 
[[Category:WordPress レッスン]]
  
{{原文|HTML_to_XHTML|149755}}<!-- 2015-02-20T20:48:46‎ Chriswgerber 版 -->
+
[[en:HTML_to_XHTML]]
 +
[[ko:HTML_to_XHTML]]

2017年7月8日 (土) 21:46時点における版

このページ「HTML to XHTML」は「XHTML の書き方」節以降が未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

XHTML は何であり何でないか

システムとしての WordPress は XHTML スクリプト言語で書かれた文書に基づいています。XHTML 1.0 (現在最も広くサポートされているバージョン。eXtensible Hyper Text Markup Language、拡張可能なハイパーテキストマークアップ言語の略) が W3C の推奨になったのは西暦2000年で、XHTML 2.0 が標準化されるまでの中継ぎとされていました。しかし8年が過ぎても XHTML 2.0 は標準になっていません (訳注: 2009年に策定が打ち切られました)。この文書では XHTML という用語を XHTML 1.0 を指すものとして使います。

XHTML はどちらも SGML と呼ばれた言語の後継である点で HTML にとてもよく似ています。しかし XHTML は、HTML よりもっと厳格な構文規則を持つスクリプト言語 XML の後継でもあり、その規則の一部を受け継いでいます。主に新しい MIME タイプの使用と新しい文法の追加という点で、XHTML は HTML と異なっています。以下にそれらの差異を説明します。

XHTML を使う理由

WordPress はすべての内部関数から XHTML を出力します。そのためすべてのテーマと、大部分のプラグインも同様に XHTML を出力します。ですから WordPress を使いたいなら、今こそが XHTML に取り組み学ぶべき時です。

XHTML と HTML の違い

HTML に慣れているなら、HTML の知識の大部分が XHTML でも通用することにホッとするでしょう。主な違いは、XHTML を使う Web ページ作者は従来よりも一貫性があり読みやすいコードを書く必要がある点です。しかし構文と文法に幾つか違いがあり、一部の HTML タグが廃止された、その程度です。HTML を知っていれば XHTML への乗り換えの容易さに驚くでしょう。そして XHTML の新しい規則はあなたを良いプログラマーに育てるでしょう !

XHTML の書き方

Well, here's a quick check list of the important requirements of XHTML and the differences between it and HTML. This is NOT a comprehensive XHTML language reference. Please look here for that.

In these examples some code has been omitted for clarity

タグ、属性、値をすべて必ず小文字で書く

正しい例:

<a href="www.kilroyjames.co.uk" >

間違った例:

<A HREF="www.kilroyjames.co.uk" >

属性値を必ずクォートで囲む

正しい例:

<a href="www.kilroyjames.co.uk">

間違った例:

<a href=www.kilroyjames.co.uk>

タグの入れ子を正しく

正しい例:

<em>this emphasis just keeps getting <strong>stronger and stronger</strong></em>

間違った例:

<em>this emphasis just keeps getting <strong>stronger and stronger</em></strong>

XHTML 文書に必ず DOCTYPE 定義を付ける

The DOCTYPE is an intimidating looking piece of code that must appear at the start of every XHTML document, it tells the browser how to render the document.

Rules for the DOCTYPE tag:

  • It must be the first tag in the document
  • The DOCTYPE is not actually part of the XHTML document so don't add a closing slash
  • It should point to a valid definition file called a DTD that tells the browser how to read the document
  • You must write the DOCTYPE tag correctly otherwise your document will explode* (into little pieces of HTML called "tag soup") and be unvalidateable.

* I am, of course, perfectly serious...


There are three types of valid XHTML 1.0 document: Strict, Transitional, and Frameset. If you can get your document to validate with "Strict" then do so, however some legacy tags and attributes aren't allowed in Strict so you can use "Transitional" instead.

Note: you might have a problem getting WordPress to validate as Strict because, as of version 2.6.2, some of the internally generated <form> elements still use the "name" attribute, which is not allowed under the Strict DTD, ie. <input name="my_button" />

Note also that using a Transitional DTD takes most browsers out of "Standards" mode. It is much trickier to get your web pages to look consistent across different browsers when the browsers are not in Standards mode. I'm not going to explain the minutiae of the DOCTYPE tag as it gets deeper and more complicated, just know that for best results you should use one of the following, preferably the first one (Strict):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

HTML タグに必ず XMLNS 属性を含める

You don't need to understand the "XML namespace" attribute, except to know that it is required in all XHTML documents. Here is an example of how to write it:

<html xmlns="http://www.w3.org/1999/xhtml">

HTML, HEAD, TITLE および BODY タグを使った適切な形式の文書

In HTML it is possible to write a webpage that contains none of the above tags; in XHTML it is not. The above tags must be included and they must be nested and ordered correctly, as follows (the DOCTYPE has been omitted):

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title></title>
 </head>
 
 <body>
  <p>   
    See how the TITLE must be placed in the document HEAD – the TITLE is considered 
to be a "required child" element of the HEAD.
Notice that the HEAD must also appear before the document BODY.
Notice also how both the HEAD and the BODY must be contained
within the HTML tag. Again, HEAD and BODY are "required child"
elements of the HTML tag. Finally, notice that this text is
written within a <p>paragraph</p> tag; in XHTML you may
not write text directly in the BODY tag without using a suitable
container tag, such as <p> or <div>. </p> </body> </html>

独立タグでも必ず正しく閉じる

<p>Mary had a little lamb
<p>It's fleece was white as snow

This code is not valid XHTML as the closing </p> tags have been left out. The following example is correct.

<p>Mary had a little lamb</p>
<p>It's fleece was white as snow</p>

In XHTML even single tags have to be closed - absolutely NO tag may be left open.

<p>
 Mary had a little lamb <br>
 It's fleece was white as snow
</p>

Therefore the above example is wrong because the <br> tag is not closed. To close a single tag like <br> and <hr> you simply add a forward slash before the final bracket, like so: <br /> and <hr /> (the white space is optional). To correct the above example we'd write:

<p>
 Mary had a little lamb <br />
 It's fleece was white as snow
</p>

This is correct XHTML.

属性の最小化は禁止

In HTML, attributes can be strung together almost like they were keywords, ie. <dl compact>, this is called attribute minimisation. In XHTML that is not allowed, attributes and values must be explicit, ie.

<dl compact="compact">

ID および NAME 属性

In HTML it was legal to use ID and NAME attributes interchangeably. In XHTML the NAME attribute is formally deprecated and cannot be used. In all cases where you would think to use a NAME attribute you must now use ID instead. e.g.

correct HTML

<input type="submit" name="s" value=" Search " >

and now the correct XHTML version

<input type="submit" id="s" value=" Search " />

STYLE はすべて HEAD に入れる

XHTML does not allow STYLE declarations within the body of a document they must be placed in the document HEAD instead.

エンティティ参照

Write all literal ampersands as &amp; or they will be assumed to be part of an entity reference. e.g. &reg; is the entity reference for the symbol ®. Therefore M&S is invalid XHTML because &S is not an entity reference, you must write it as M&amp;S.

まとめ

As was previously mentioned, this is not a comprehensive reference but it should be enough to get you up and running with XHTML pretty quickly. Good luck!

XHTML の問題点

Most people don't realise that to use XHTML properly it must be served using the new MIME TYPE "application/xhtml+xml". A MIME TYPE is simply a description that the web server sends to a browser to tell it what sort of document is coming. For instance a JPG image is sent with a MIME TYPE of "image/jpeg" and an HTML document with a MIME TYPE of "text/html". Sending an XHTML document with a MIME TYPE of "text/html" results in the document being parsed and validated as HTML, not as you would no doubt hope, as XHTML. You must use the correct MIME TYPE if you want to use XHTML otherwise you are simply using non-standard HTML. In order to avoid this problem and output standards compliant code you can use the XHTML to HTML wordpress plugin.

HTML5

Because of seemingly intractable problems with the development of XHTML (mainly that XHTML 2 is incompatible with previous versions of XHTML and HTML and also the MIME TYPE issue), a competing standard supported by Mozilla (Firefox), Apple (Safari), Opera, Microsoft (Internet Explorer) and some other key Internet players has become the new favourite to succeed the old HTML 4.01 standard.

HTML5 was passed as a working draft by the W3C in January 2008 and became a candidate recommendation in December 2012.

関連項目