본문 바로가기

[R]HTML 과 XHTML(HTML and XHTML)


XHTML is HTML written as XML.

XHTML은 XML로 작성된 HTML입니다.



What Is XHTML?

XHTML은 무엇입니까?


  • XHTML stands for EXtensible HyperText Markup Language
    XHTML은 EXtensible Hyper TEXT Markup의 Language
  • XHTML is almost identical to HTML
    XHTML은 HTML과 거의 동일합니다.
  • XHTML is stricter than HTML
    XHTML은 HTML보다 엄격합니다.
  • XHTML is HTML defined as an XML application
    XHTML은 XML 애플리케이션으로 정의 된 HTML입니다.
  • XHTML is supported by all major browsers
    XHTML은 모든 주요 브라우저에서 지원됩니다.



Why XHTML?

왜 XHTML인가?


Many pages on the internet contain "bad" HTML.

인터넷의 많은 페이지에는 "잘못된"HTML이 포함되어 있습니다.

This HTML code works fine in most browsers (even if it does not follow the HTML rules):

이 HTML 코드는 대부분의 브라우저에서 잘 작동합니다 (HTML 규칙을 따르지 않더라도).


1
2
3
4
5
6
7
8
<html>
<head>
  <title>This is bad HTML</title>
 
<body>
  <h1>Bad HTML
  <p>This is a paragraph
</body>
cs


Today's market consists of different browser technologies. 

오늘날의 시장은 다양한 브라우저 기술로 구성됩니다. 

Some browsers run on computers, and some browsers run on mobile phones or other small devices. 

일부 브라우저는 컴퓨터에서 실행되며 일부 브라우저는 휴대 전화 또는 기타 소형 장치에서 실행됩니다.

Smaller devices often lack the resources or power to interpret "bad" markup.

작은 장치는 종종 "나쁜"마크 업을 해석 할 수있는 자원이나 능력이 부족합니다.

XML is a markup language where documents must be marked up correctly (be "well-formed").

XML은 문서를 올바르게 마크 업해야하는 마크 업 언어입니다 ( "올바른 형식"이어야 함).

If you want to study XML, please read our XML tutorial.

XML을 배우고 싶다면 XML 자습서 를 읽어보십시오 .

XHTML was developed by combining the strengths of HTML and XML.

XHTML은 HTML과 XML의 장점을 결합하여 개발되었습니다.

XHTML is HTML redesigned as XML.

XHTML은 XML로 재 설계된 HTML입니다.



The Most Important Differences from HTML:

HTML과 가장 중요한 차이점 :


Document Structure

문서 구조

XHTML DOCTYPE is mandatory

XHTML DOCTYPE은 필수 항목입니다.

The xmlns attribute in <html> is mandatory

<html>의 xmlns 속성은 필수 항목입니다.

<html>, <head>, <title>, and <body> are mandatory

<html>, <head>, <title> 및 <body>는 필수 항목입니다.


XHTML Elements

XHTML 요소

XHTML elements must be properly nested

XHTML 요소는 올바르게 중첩 되어야합니다.

XHTML elements must always be closed

XHTML 요소는 항상 닫혀 있어야합니다.

XHTML elements must be in lowercase

XHTML 요소는 소문자 여야합니다.

XHTML documents must have one root element

XHTML 문서에는 하나의 루트 요소 가 있어야합니다.


XHTML Attributes

XHTML 속성

Attribute names must be in lower case

속성 이름은 소문자 여야합니다.

Attribute values must be quoted

속성 값은 따옴표 로 묶어야합니다.

Attribute minimization is forbidden

속성 최소화는 금지되어 있습니다.



<!DOCTYPE ....> Is Mandatory

<! DOCTYPE ....> 필수 항목 임


An XHTML document must have an XHTML DOCTYPE declaration.

XHTML 문서에는 XHTML DOCTYPE 선언이 있어야합니다.

A complete list of all the XHTML Doctypes is found in our HTML Tags Reference.

모든 XHTML Doctype 의 전체 목록은 HTML Tags Reference에 있습니다.

The <html>, <head>, <title>, and <body> elements must also be present, and the xmlns attribute in <html> must specify the xml namespace for the document.

<html>, <head>, <title> 및 <body> 요소도 있어야하며 <html>의 xmlns 속성은 문서의 XML 네임 스페이스를 지정해야합니다.

This example shows an XHTML document with a minimum of required tags:

이 예제는 최소한의 필수 태그가있는 XHTML 문서를 보여줍니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
  <title>Title of document</title>
</head>
 
<body>
  some content 
</body>
 
</html>
cs



XHTML Elements Must Be Properly Nested

XHTML 요소가 적절히 중첩되어야 함


In HTML, some elements can be improperly nested within each other, like this:

HTML에서 일부 요소는 다음과 같이 서로 내부에 잘못 배치 될 수 있습니다.


1
<b><i>This text is bold and italic</b></i>
cs


In XHTML, all elements must be properly nested within each other, like this:

XHTML에서 모든 요소는 다음과 같이 서로 충분히 중첩되어야합니다.


1
<b><i>This text is bold and italic</i></b>
cs



XHTML Elements Must Always Be Closed

XHTML 요소는 항상 닫혀 있어야합니다.


This is wrong:

이것은 잘못된 것입니다.

1
2
<p>This is a paragraph
<p>This is another paragraph
cs


This is correct:

올바른 내용입니다.

1
2
<p>This is a paragraph</p>
<p>This is another paragraph</p>
cs



Empty Elements Must Also Be Closed

빈 요소도 닫아야 함


This is wrong:

이것은 잘못된 것입니다.

1
2
3
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face">
cs


This is correct:

올바른 내용입니다.

1
2
3
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" />
cs



XHTML Elements Must Be In Lower Case

XHTML 요소는 소문자 여야합니다.


This is wrong:

이것은 잘못된 것입니다.

1
2
3
<BODY>
<P>This is a paragraph</P>
</BODY>
cs


This is correct:

올바른 내용입니다.

1
2
3
<body>
<p>This is a paragraph</p>
</body>
cs



XHTML Attribute Names Must Be In Lower Case

XHTML 속성 이름은 소문자 여야합니다.


This is wrong:

이것은 잘못된 것입니다.

1
<table WIDTH="100%">
cs


This is correct:

올바른 내용입니다.

1
<table width="100%">
cs



Attribute Values Must Be Quoted

속성 값은 반드시 인용되어야한다.


This is wrong:

이것은 잘못된 것입니다.

1
<table width=100%>
cs


This is correct:

올바른 내용입니다.

1
<table width="100%">
cs



Attribute Minimization Is Forbidden

속성 최소화가 금지되었습니다.


Wrong:

1
<input type="checkbox" name="vehicle" value="car" checked />
cs

Correct:

1
<input type="checkbox" name="vehicle" value="car" checked="checked" />
cs

Wrong:

1
<input type="text" name="lastname" disabled />
cs

Correct:

1
<input type="text" name="lastname" disabled="disabled" />
cs



How to Convert from HTML to XHTML

HTML에서 XHTML로 변환하는 방법


Add an XHTML <!DOCTYPE> to the first line of every page

모든 페이지의 첫 줄에 XHTML <! DOCTYPE> 추가

Add an xmlns attribute to the html element of every page

모든 페이지의 html 요소에 xmlns 속성 추가

Change all element names to lowercase

모든 요소 이름을 소문자로 변경하십시오.

Close all empty elements

모든 빈 요소를 닫습니다.

Change all attribute names to lowercase

모든 속성 이름을 소문자로 변경하십시오.

Quote all attribute values

모든 속성 값을 인용하십시오



Validate HTML With The W3C Validator

W3C 검사기로 HTML 유효성 검사


아래 상자에 웹 주소를 입력하십시오 :



출처 : w3schools.com