Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 993609 of XHTML

  • Revision slug: Glossary/XHTML
  • Revision title: XHTML
  • Revision id: 993609
  • Created:
  • Creator: jeonnoej
  • Is current revision? No
  • Comment

Revision Content

HTML은 HTML 문법 또는 XHTML이라는 XML 문법으로 브라우저를 통해 네트워크를 여행할 수 있다.

HTML5 과 HTML/XHTML

HTML5 표준은 위의 두가지의 문법을 모두 정의한다. MIME 타입(HTTP 헤더 content-type 으로 전송되는)이 어 떤 문법을 사용할지 결정한다. XHTML MIME  타입은 "application/xhtml+xml"이며 그 이외는 "text/html"을 사용한다.

아래의 예제는 HTML 문서와 XHTML문서 각각의 HTTP 헤더를 보여준다.

HTML document

HTTP/1.1 200 OK
Content-Type: text/html

<!DOCTYPE html>
<html lang=en>
  <head>
    <meta charset=utf-8>
    <title>HTML</title>
  </head>
  <body>
    <p>I am a HTML document</p>
  </body>
</html>

XHTML document

HTTP/1.1 200 OK
Content-Type: application/xhtml+xml

<html xml:lang="en" xmlns="https://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML</title>
  </head>
  <body>
    <p>I am a XHTML document</p>
  </body>
</html>

MIME type vs DOCTYPE

HTML5 이전에는 HTML 4.01 과 XHTML 1.0  두개의 표준이 분리되어 정의되었다. XHTML1 표준에 따르면, XHTML을 사용하기 위해서는 특별한 DOCTYPE을 정의해야 한다고 명시되어있다. 하지만 모든 브라우저들은 이 표준을 구현하지 않았고 반대로 HTML5 표준에서 다음과 같이 결정되었다. "페이지에서 content-type을 text/html로  전송한다면 XHTML을 사용하지 않는 것이다."

Instead, the proper MIME type must be present in the Content-Type HTTP header. If you only put the MIME type into an HTML meta tag like <meta http-equiv=…>, it will be ignored and treated like text/html.

If you serve your pages as text/html and believe that you are writing XHTML, you may face several problems, as described in these articles:

Support

Most browsers currently support XHTML, including Firefox, Chrome, Safari, Opera, and Internet Explorer (since IE 9). (Internet Explorer 8 and older browsers instead show a download dialog box for unknown file types when they see an XHTML document with the correct XHTML MIME type.)

Also be aware that many popular {{Glossary("JavaScript")}} libraries and developer tools have limited or no support for XHTML.

Differences from HTML

See Properly Using CSS and JavaScript in XHTML Documents for a partial list of differences between HTML and XHTML.

Tools

See also

View All...

Revision Source

<p><a href="/en-US/docs/HTML" title="HTML">HTML</a>은 HTML 문법 또는&nbsp;XHTML이라는&nbsp;<a href="/en-US/docs/XML" title="XML">XML</a> 문법으로 브라우저를 통해 네트워크를 여행할 수 있다.</p>

<h2 id="HTML5_and_HTMLXHTML">HTML5 과 HTML/XHTML</h2>

<p><a href="/en-US/docs/HTML/HTML5">HTML5</a> 표준은 위의 두가지의 문법을 모두 정의한다. MIME 타입(HTTP 헤더 content-type 으로 전송되는)이 어 떤 문법을 사용할지 결정한다. XHTML MIME &nbsp;타입은 "application/xhtml+xml"이며 그 이외는 "text/html"을 사용한다.</p>

<p>아래의 예제는 HTML 문서와 XHTML문서 각각의&nbsp;HTTP 헤더를&nbsp;보여준다.</p>

<h3 id="HTML_document">HTML document</h3>

<pre class="brush: html">
HTTP/1.1 200 OK
Content-Type: text/html

&lt;!DOCTYPE html&gt;
&lt;html lang=en&gt;
  &lt;head&gt;
    &lt;meta charset=utf-8&gt;
    &lt;title&gt;HTML&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;p&gt;I am a HTML document&lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>

<h3 id="XHTML_document">XHTML document</h3>

<pre class="brush: xml">
HTTP/1.1 200 OK
Content-Type: application/xhtml+xml

&lt;html xml:lang="en" xmlns="<code>https://www.w3.org/1999/xhtml</code>"&gt;
  &lt;head&gt;
    &lt;title&gt;XHTML&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;p&gt;I am a XHTML document&lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>

<h2 id="MIME_type_versus_DOCTYPE">MIME type vs DOCTYPE</h2>

<p>HTML5 이전에는 <a class="external" href="https://www.w3.org/TR/html4/" title="https://www.w3.org/TR/html4/">HTML 4.01</a>&nbsp;과&nbsp;<a class="external" href="https://www.w3.org/TR/xhtml1/">XHTML 1.0</a>&nbsp; 두개의 표준이 분리되어&nbsp;정의되었다. XHTML1 표준에 따르면, XHTML을 사용하기 위해서는 특별한 DOCTYPE을 정의해야 한다고 명시되어있다.&nbsp;하지만 모든 브라우저들은 이 표준을 구현하지 않았고&nbsp;반대로 HTML5 표준에서 다음과 같이&nbsp;결정되었다. "<strong>페이지에서 content-type을&nbsp;text/html로&nbsp;&nbsp;전송한다면 XHTML을 사용하지 않는 것이다."</strong></p>

<p>Instead, the proper MIME type must be present in the <code>Content-Type</code> HTTP header. If you only put the MIME type into an HTML meta tag like <code>&lt;meta http-equiv=…&gt;</code>, it will be ignored and treated like <code>text/html</code>.</p>

<p>If you serve your pages as <code>text/html</code> and believe that you are writing XHTML, you may face several problems, as described in these articles:</p>

<ul>
 <li><a class="external" href="https://www.spartanicus.utvinternet.ie/no-xhtml.htm">No to XHTML</a> an excellent article from Spartanicus</li>
 <li><a class="external" href="https://www.webdevout.net/articles/beware-of-xhtml">Beware of XHTML</a> by David Hammond</li>
 <li><a class="external" href="https://www.hixie.ch/advocacy/xhtml">Sending XHTML as text/html Considered Harmful</a> by Ian Hickson</li>
 <li><a class="external" href="https://www.xml.com/pub/a/2003/03/19/dive-into-xml.html">XHTML's Dirty Little Secret</a> by Mark Pilgrim</li>
 <li><a class="external" href="https://hsivonen.iki.fi/xhtml-the-point/">XHTML - What's the Point?</a> by Henri Sivonen</li>
 <li><a class="external" href="https://lachy.id.au/log/2005/12/xhtml-beginners">XHTML is not for Beginners</a> by Lachlan Hunt</li>
</ul>

<h2 id="Support">Support</h2>

<p>Most browsers currently support XHTML, including Firefox, Chrome, Safari, Opera, and Internet Explorer (since IE 9). (Internet Explorer 8 and older browsers instead show a download dialog box for unknown file types when they see an XHTML document with the correct XHTML MIME type.)</p>

<p>Also be aware that many popular {{Glossary("JavaScript")}} libraries and developer tools have limited or no support for XHTML.</p>

<h2 id="Differences_from_HTML">Differences from HTML</h2>

<p>See <a href="/en-US/docs/Properly_Using_CSS_and_JavaScript_in_XHTML_Documents" title="Properly Using CSS and JavaScript in XHTML Documents">Properly Using CSS and JavaScript in XHTML Documents</a> for a partial list of differences between HTML and XHTML.</p>

<h2 id="Tools" name="Tools">Tools</h2>

<ul>
 <li><a href="/en-US/docs/Standards-Compliant_Authoring_Tools" title="Standards-Compliant_Authoring_Tools">Standards-Compliant Authoring Tools</a></li>
</ul>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/HTML" title="HTML">HTML</a></li>
 <li><a href="/en-US/docs/Namespaces" title="Namespaces">Namespaces</a></li>
</ul>

<p><span class="alllinks"><a href="/en-US/docs/tag/XHTML:Tools" title="tag/XHTML:Tools">View All...</a></span></p>
Revert to this revision