
(1) 웹이란 무엇인가?
웹과 인터넷의 관계: 웹 ≠ 인터넷, 인터넷이 web을 포괄하는 개념
서버와 클라이언트
서버: 클라이언트에게 응답
클라이언트: 서버에게 요청

(2) HTML의 정의
HTML: 웹 페이지를 만드는 언어
(3) HTML 문법
앞뒤로 강조 표시한 부분: 열리는 태그 & 닫히는 태그 / 생활코딩: 컨텐츠
a: 태그명, 링크
herf: 속성명, 이 속성값으로 "http://opentutorials.org" (” “로 묶어줌)
*닫히는 태그는 태그 앞에 ‘/’가 붙음
(4) 문서의 구조
<html>
<head>
문서를 정의하는 데이터가 위치함
</head>
<body>
문서에 표시되는 컨텐츠가 위치함
</body>
</html>HTML 문서의 파일 확장자: .html 혹은 .htm
최상위 태그로 사용, 그 하위에 와 태그
*참고: 메타 데이터(meta data): 데이터를 설명하는 데이터로, 태그가 대표적인 메타 데이터.
<a> 태그 사용해서 링크를 만들고 <img> 태그를 이용해 이미지 출력<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<img alt="생활코딩 로고" scr="https://opentutorials.org/user/course/1/94.png" />
<br/>
<a href="https://opentutorials.org/course/1">생활코딩</a>
</body>
</html>
(5) 실습방법과 개발도구
<!DOCTYPE html>(1) BODY 태그란
(2) 링크
<a href="URL" title="설명" target="문서가 로드될 대상">링크이름</a><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<p>
<a href="http://opentutorials.org/course/1">생활코딩</a> : 생활코딩 홈페이지로 이동한다.
</p>
<p>
<a href="http://opentutorials.org/course/1" target="_blank">생활코딩</a> : 새창에서 생활코딩 홈페이지를 연다. (_blank)
</p>
<p>
<a href="http://opentutorials.org" target="_self">생활코딩</a> : 현재 프래임에서 생활코딩 홈페이지를 연다.
</p>
<p>
<a href="http://opentutorials.org" title="생활코딩 홈페이지">생활코딩</a> : 링크에 부가 설명을 추가한다. 링크에 툴팁을 표시한다.
</p>
<p>
<a href="http://opentutorials.org/course/11/10#reference" title="생활코딩 html이란 무엇인가 참조">HTML 소개 참조</a> : 생활코딩의 HTML소개 페이지 중 참조 부분으로 문서를 이동한다.
</p>
</body>
</html><!DOCTYPE html>
<html>
<body>
<iframe name="sample" src="http://w3c.org/" width="100%" height="300"></iframe>
<a href="http://opentutorials.org/" target="sample">아이프래임</a>
</body>
</html>(3) 문단, 줄바꿈, 띄어쓰기
<p>문단</p>문장<br />문장 문장(4) 이미지
<img src="이미지가 위치하는 URL" alt="대체텍스트" width="폭" height="높이" longdesc="링크" />(5) 목록(ul>li, ol>li)
<ul>
<li>항목</li>
</ul> 순서가 있는 리스트 (Ordered List)<ol>
<li>항목</li>
</ol><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<ol>
<li>html
<ol>
<li>수업</li>
<li>사전</li>
<li>쿡북</li>
</ol>
</li>
<li>css</li>
<li>javascript</li>
<li>os</li>
<li>php</li>
<li>database</li>
</ol>
</body>
</html>(6) 아이프레임, 프레임
<iframe src="불러올 웹페이지의 URL" scrolling="스크롤링 허용여부(yes|no|auto)">
iframe를 지원하지 않는 브라우저인 경우 대체정보를 제공
</iframe>src : 불러올 페이지의 URL
scrolling : 아이프레임 안에서 스크롤링을 허용할 것인지를 지정
- auto : 스크롤이 필요한 경우만 스크롤 바를 노출 (기본 값)
- yes : 스크롤링 허용, 스크롤이 필요 없는 경우도 스크롤 바를 노출
- no : 스크롤 하지 않음
*참고: width, height, frameborder(프레임의 테두리 사용여부) 등의 속성이 더 있지만, 디자인은 CSS를 통해 제어하는 것이 권장
<!DOCTYPE html>
<html>
<body>
<iframe src="http://opentutorials.org" width="90%" height="300" frameborder="1" scrolling="yes"></iframe>
</body>
</html>(7) 이스케이핑
<!DOCTYPE html>
<html>
<body>
<br />은 줄바꿈을 의미하는 태그입니다.
</body>
</html>& → & (ampersand, U+0026)< → < (less-than sign, U+003C)> → > (greater-than sign, U+003E)" → " (quotation mark, U+0022)' → ' (apostrophe, U+0027)(8) 표
표: 데이터를 구조화할 때 사용, 레이아웃으로도 사용 가능(div와 css가 더 많이 사용됨)
문법
<table>
<tr>
<th>제목</th>
</tr>
<tr>
<td>데이터</td>
</tr>
</table>
예제
<!DOCTYPE html>
<html>
<body>
<table border="1">
<tr>
<th>이름</th><th>성별</th><th>나이</th>
</tr>
<tr>
<td>최진혁</td><td colspan="2">비공개</td>
</tr>
<tr>
<td>최유빈</td><td>여</td><td>2</td>
</tr>
</table>
</body>
</html>
(1) HEAD 태그란?
(2) meta
<meta name="" content="" />
<meta http-equiv="" content="" /><!DOCTYPE html>
<html>
<head>
<meta name="description" content="생활코딩은 일반인에게 프로그래밍을 알려주는 온라인 수업" />
<meta name="keywords" content="생활코딩, HTML, HEAD, META" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
</html><!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="2;url=http://opentutorials.org/">
</head>
</html>(3) title
<!DOCTYPE html>
<html>
<head>
<title>생활코딩</title>
</head>
<body>
생활코딩은....
</body>
</html>(1) 서버와 클라이언트

(2) 폼 (form)
<form action="서버로 전송한 데이터를 수신할 URL" method="데이터를 전송하는 방법">
텍스트 필드, 라디오 버튼, 체크 박스와 같은 컨트롤을 생성하는 태그
</form>예제 1
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<fieldset>
<legend>
GET
</legend>
<form action="./example2.php" method="GET">
<p>
닉네임 :
<input type="text" name="nickname" />
<br />
</p>
<p>
직업 :
<select name="job">
<option value="designer">디자이너</option>
<option value="programmer">프로그래머</option>
<option value="planner">기획자</option>
</select>
</p>
<input type="submit" value="전송"/>
</form>
</fieldset>
<fieldset>
<legend>
POST
</legend>
<form action="./example2.php" method="POST">
<p>
닉네임 :
<input type="text" name="nickname" />
<br />
</p>
<p>
직업 :
<select name="job">
<option value="designer">디자이너</option>
<option value="programmer">프로그래머</option>
<option value="planner">기획자</option>
</select>
</p>
<input type="submit" value="전송"/>
</form>
</fieldset>
</body>
</html>
예제 2
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<?php
echo $_REQUEST['nickname'].'님의 직업은 '.$_REQUEST['job'].'이군요!';
?>
</body>
</html>
(3) 텍스트 입력
<textarea name="값의 이름" rows="행의 수" cols="열의 수" disabled="disabled" readonly="readonly">값</textarea>(4) 선택
<input type="radio" name="값의 이름" value="값" checked="checked"><select name="값의 이름" multiple="multiple">
<option value="선택될 경우 name의 값이 됨" selected="selected">값에 대한 표시값</option>
...option 반복
</select><input type="checkbox" name="값의 이름" value="값" /><form action="example_receive_multi.php" method="POST">
관심사 : <br />
<input type="checkbox" name="interest[]" value="programming" /> 프로그래밍<br />
<input type="checkbox" name="interest[]" value="design" /> 디자인<br />
<input type="checkbox" name="interest[]" value="planning" checked="checked" /> 기획<br />
<input type="submit" />
</form>(5) 파일전송
<input type="file" name="서버쪽에서 파일을 식별하기 위한 이름" /><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<form action="example_receive.php" method="POST" enctype="multipart/form-data">
<input type="file" name="image" />
<input type="submit" />
</form>
</body>
</html>(1) URL
| 부분 | 명칭 | 설명 |
|---|---|---|
| http:// | scheme | 통신에 사용되는 방식, 프로토콜 |
| codingeverybody.com | hosts | 자원이 위치하고 있는 웹서버의 이름, 도메인이나 IP가 사용된다. |
| /codingeverybody_html_tutorial/url_72/example2.html | url-path | 루트 디렉토리부터 자원이 위치한 장소까지의 디렉토리와 파일명 |
| ?mode=view | query | 웹서버에 넘기는 추가적인 질문 |
| #bookmark | bookmark | 하이퍼링크를 클릭했을 때 특정 위치로 이동하기 위해서 사용 |
(2) 경로 (path)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<style>
img{
height:50px;
width:50px;
}
#structure{
width:379px;
height:124px;
border:1px solid gray;
}
body{
font-size:0.8em;
}
table {
width:100%;
border-collapse: collapse;
}
td, th{
border:1px solid gray;
padding:5px;
}
textarea{
width:100%;
border:none;
}
.div{width:50px}
.ex{width:30px;}
.desc{width:150px}
.result{width:60px}
</style>
</head>
<body>
<p>
exampe1.html 파일이 아래와 같은 디렉토리 구조 위에 위치한다고 간주한다. <br />
<img id="structure" src="structure.gif" />
</p>
<table>
<tr>
<th class="div">구분</th>
<th class="ex">기호</th>
<th class="desc">설명</th>
<th class="code">코드</th>
<th class="result">결과</th>
</tr>
<tr>
<td rowspan="3">상대경로</td>
<td>../</td>
<td>부모 디렉토리</td>
<td>
<textarea><img src="../image/logo.png" /></textarea>
</td>
<td>
<img src="../image/logo.png" />
</td>
</tr>
<tr>
<td>./</td>
<td>현재 디렉토리</td>
<td>
<textarea><img src="./image/logo.png" /></textarea>
</td>
<td>
<img src="./image/logo.png" />
</td>
</tr>
<tr>
<td>없음</td>
<td>현재 디렉토리 기호는 생략할 수 있다</td>
<td>
<textarea><img src="image/logo.png" /></textarea>
</td>
<td>
<img src="image/logo.png" />
</td>
</tr>
<tr>
<td rowspan="2">절대경로</td>
<td>/</td>
<td>루트(root) 디렉토리</td>
<td>
<textarea><img src="/codingeverybody_html_tutorial/url_72/image/logo.png" /></textarea>
</td>
<td>
<img src="/codingeverybody_html_tutorial/url_72/image/logo.png" />
</td>
</tr>
<tr>
<td>URL</td>
<td>URL을 사용</td>
<td>
<textarea><img src="http://codingeverybody.com/codingeverybody_html_tutorial/url_72/image/logo.png" /></textarea>
</td>
<td>
<img src="http://codingeverybody.com/codingeverybody_html_tutorial/url_72/image/logo.png" />
</td>
</tr>
</table>
</body>
</html>(3) 검색엔진최적화 (SEO)