
text/html과 application/xhtml+xml이 존재text/html : SGML 베이스의 HTMLapplication/xhtml+xml : XML 베이스의 XHTML.html 또는 .htm 확장자를 이용.htm 은 OS의 제약에 의한 것.html 을 붙이도록 리소스를 설계<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>첫 번째 HTML</title></head>
<body>
<h1>첫 번째 HTML</h1>
<p>HTML의 사양서는<a href="http://www.w3.org">W3C</a>에 있습니다.</p>
</body>
</html>
XML의 트리구조

요소
<br/>
// 2000년에 측정된 XHTML 1.0 스펙에서는 브라우저와의 호환성을 위해 '/>' 앞에 공백을 넣는 기법을 권장
<br />
속성
실제 참조와 문자 참조
| 문자 | 실체 참조 |
|---|---|
| < | &It; |
| > | > |
| “ | "e; |
| ‘ | ' |
| & | & |
©©코멘트
XML 선언
```html
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
...
</html>
```
- XML의 버전과 문자 인코딩 방식을 지정이름공간
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/Atom"
xmlns:atom="http://www.w3.org/2005/Atom">
<head>
<link rel="stylesheet" href="base.css"/>
<atom:link rel="enclosure" href="attachment.mp3"/>
</head>
...
</html>```html
<entry xmlns="http:/www.w3.org/2005/Atom"
xmlns:thr="http://purl.org/sydication/thread/1.0">
<link href="blog.example.com/entries/1/commentsfeed"
thr:count="10">
</entry>
```<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>첫 번째 HTML</title>
<link rel="stylesheet" href="http://example.com/main.css"/>
<script type="text/javascript"
src="http://example.com/sample.js"></script>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8"/>
</head>
<body> ... </body>
</html>
| 요소 | 의미 |
|---|---|
| title | 문서의 타이틀 |
| link | 다른 리소스로의 링크 |
| script | JavaScript 등의 클라이언트 사이드 프로그램 |
| meta | 그 밖의 파라미터 |
| 요소 | 의미 |
|---|---|
| h1, h2, h3, h4, h5, h6 | 표제 |
| dl, ul, ol | 리스트 |
| div | 블록 레벨 요소의 그룹화 |
| p | 단락 |
| address | 어드레스 정보 |
| pre | 미리 포맷이 정해진 텍스트 |
| table | 표 |
| form | 폼 |
| blockquote | 인용 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>블록 레벨 요소</title></head>
<body>
<div>
<h1>블록 레벨 요소</h1>
<p>HTML이란...</p>
<ol>
<li>순서 있는 리스트1</li>
<li>순서 있는 리스트2</li>
</ol>
<ul>
<li>순서 없는 리스트1</li>
<li>순서 없는 리스트2</li>
</ul>
<dl>
<dt>정의어1</dt><dd>정의어1의 설명</dd>
<dt>정의어2</dt><dd>정의어2의 설명</dd>
</dl>
<pre>
function foo() {
return true;
}
</pre>
<form action="http://example.com/search">
<input type="text" id="q"/>
<input tpye="submit" value="검색"/>
</form>
<blockquote><p>인용문</p></blockquote>
</div>
</body>
</html>

| 요소 | 의미 |
|---|---|
| em | 강조 |
| strong | 강한 강조 |
| dfn | 정의어 |
| code | 소스 코드 |
| samp | 예 |
| kbd | 키보드 입력문자 |
| var | 변수 |
| cite | 인용 또는 다른 리소스의 참조 |
| abbr | WWW, HTTP 같은 약자, 생략형 |
| a | 앵커 |
| q | 인라인의 인용 |
| sub | 아래첨자 |
| sup | 위첨자 |
| br | 줄 바꿈 |
| ins | 삽입한 문자열 |
| del | 삭제한 문자열 |
| img | 이미지 |
| object | 오브젝트 |
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>인라인 요소</title>
</head>
<body>
<h1>인라인 요소</h1>
<p><**abbr**>**HTML**</**abbr**>에는 여러 가지 요소가 있습니다.</p>
<p><**em**>**강조**</**em**>,<**strong**>**강한 강조**</**strong**></p>
<p><**dfn**>**스테이트리스성**</**dfn**>이란...</p>
<p><**code**>**p**"**a**" + "**b**"</**code**>의 출력은<**samp**>"**ab**"</**samp**>입니다.</p>
<p>자세한 사항은<**cite**>**웹을 지탱하는 기술**</**cite**>을 참조해 주십시오.</p>
<p>공자 왈,<**br**/><**q**>**배우고 때로 이를 익히면**...</**q**></p>
<p>H<**sub**>**2**</**sub**></p>
<p>E=mc<**sup**>**2**</**sup**></p>
<p>간식은<**del**>**300**</**del**><**ins**>**500**</**ins**>원 이내</p>
</body>
</html>

id 속성
http://example.com/test.html#titleclass 속성
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>id속성과 class속성</title></head>
<body>
<h1 **id**="**title**">첫 번째 HTML</h1>
<p>저자: <span **class**="**author**">야마다 타로</span></p>
</body>
</html>
h1#title {
font-size: 120%
}
span.author {
color: red
}
<a>요소 - 앵커
<a> 요소를 사용<a> 요소의 내용을 앵커 텍스트라고 함<link>요소
오브젝트의 삽입
<img>요소를, 그 밖의 오브젝트의 삽입에는 <object>요소를 이용<!--<img>요소의 예-->
<img src="http://example.com/children.png" alt="아이들 사진"/>
<!--<object>요소의 예-->
<object data="http://example.com/children.mpeg">아이들의 동영상</object>폼
rel 속성
| alternate | 번역 등의 대체 문서로 링크 |
|---|---|
| stylesheet | 외부 스타일시트로 링크 |
| start | 문서군의 최초의 문서로 링크 |
| next | 문서군의 다음 문서로 링크 |
| pre | 문서군의 이전 문서로 링크 |
| contents | 목차로 링크 |
| index | 색인으로 링크 |
| glossary | 용어집으로 링크 |
| copyright | 저작권표시로 링크 |
| chapter | 챕터로 링크 |
| section | 섹션으로 링크 |
| subsection | 서브섹션으로 링크 |
| appendix | 부속서로 링크 |
| help | 헬프로 링크 |
| bookmark | 문서중의 북마크로 링크 |
microformats