http://www.w3schools.com/html/html_intro.asp 사이트 부터 시작

HTML Introduction

HTML 소개

What is HTML?

HTML이란 무엇인가?

HTML is a markup language for describing web documents (web pages).
HTML은 웹 문서(웹 페이지)를 설명하기 위한 마크업 언어이다.

  • HTML stands for Hyper Text Markup Language
  • A markup language is a set of markup tags
  • HTML documents are described by HTML tags
  • Each HTML tag describes different document content

  • HTML은 Hyper Text Markup Language의 약자입니다.
  • markup언어는 markup태그의 세트입니다.
  • HTML 문서들은 HTML태그에 의해 설명됩니다.
  • 각각의 HTML태그는 다른문서의 내용을 설명합니다.

HTML Example

HTML의 예제

A small HTML document:

짧은 HTML문서:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

Example Explained

예제 설명

* The DOCTYPE declaration defines the document type to be HTML
* The text between <html> and </html> describes an HTML document
* The text between <head> and </head> provides information about the document
* The text between <title> and </title> provides a title for the document
* The text between <body> and </body> describes the visible page content
* The text between <h1> and </h1> describes a heading
* The text between <p> and </p> describes a paragraph

* DOCTYPE선언은 HTML문서가 될 수 있도록 정의합니다.
* <html>와</html>사이에서 HTML문서를 제공합니다.
* <head>와</head>사이에서 문서의 정보를 제공합니다.
* <title>와</title>사이에서 문서의 제목을 제공합니다.
* <body>와</body>사이에서 보여지는 페이지의 내용을 설명합니다.
* <h1>와</h1>사이에서 설명에대한 제목입니다.
* <p>와</p>사이에서 설명에대한 단락입니다.

Using this description, a web browser can display a document with a heading and a paragraph.

이 내용은 웹 브라우저 문서에서 제목과 단락을 함께 표시할 때 사용 합니다.


HTML Tags

HTML 태그

HTML tags are keywords (tag names) surrounded by angle brackets:

키워드(태그이름)는 HTML태그안에 둘러싸여있습니다:

<tagname>content</tagname>

<태그이름> 내용 </태그이름>
  • HTML tags normally come in pairs like <p> and </p>
  • The first tag in a pair is the start tag, the second tag is the end tag
  • The end tag is written like the start tag, but with a slash before the tag name

  • HTML태그들은 보통 <p>와</p>쌍으로 된 형태입니다.
  • 쌍 중에서 첫번째 태그는 시작 태그이고, 두번째 태그는 끝 태그입니다.
  • 종료 태그는 시작 태그와 동일하게 씁니다, 하지만 태그이름 앞에 슬래쉬를 같이 씁니다.

The start tag is often called the opening tag. The end tag is often called the closing tag.

시작 태그는 여는 태그라고도 자주 불립니다. 끝 태그는 닫는 태그 라고불립니다.


Web Browsers

웹 브라우저

The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them. The browser does not display the HTML tags, but uses them to determine how to display the document:

웹 브라우저의 목적은(크롬, IE, 파이어폭스, 사파리) HTML문서를 판독해서 보여줍니다. 브라우저에 HTML태그를 표시는 하지만 문서에 보여지기위한 방법을 결정하지 않습니다:


HTML Page Structure

HTML 페이지 구조

Below is a visualization of an HTML page structure:

아래 보이는 것은 HTML페이지의 구조입니다.

<html>
	<head>
		<title> Page title </title>
	<head>

	<body>
		<h1> This is a heading </h1>
		<p>This is a paragraph </p>
		<p> This is another paragraph <p>
	</body>
</html>

Only the <body> area (the yellow area) is displayed by the browser.

<body>지역(노란지역)만 화면에 보여집니다.


The <!DOCTYPE> Declaration

<!DOCTYPE>선언문

The <!DOCTYPE> declaration helps the browser to display a web page correctly. There are different document types on the web. To display a document correctly, the browser must know both type and version. The doctype declaration is not case sensitive. All cases are acceptable:

정확히 말해서 <!DOCUTYPE>은 브라우저에 보이기위해서 웹페이지에 선언합니다.
웹에는 다른 문서 종류가 있습니다.
문서를 정확하게 표시하려면, 브라우저의 버전과 종류 두가지다 알아야합니다.
DOCUTYPE은 대소문자를 구분하지 않습니다. 모든 경우에 해당됩니다:
<!DOCTYPE html>

<!DOCTYPE HTML>

<!doctype html>

<!Doctype Html>

Common Declarations

일반적인 선언

HTML5

<!DOCTYPE html>

HTML 4.01

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

XHTML 1.0

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

All tutorials and examples at W3Schools use HTML5. W3Scholls에서는 모든 자습서와 예제에 HTML5를 사용합니다.


HTML Versions

HTML 버전

Since the early days of the web, there have been many versions of HTML: 웹은 초기부터 지금까지 많은 HTML 버전을 가지고 있습니다.

Version     Year
HTML        1991
HTML 2.0    1995
HTML 3.2    1997
HTML 4.01   1999
XHTML       2000
HTML5       2014

HTML Editors

HTML 편집

Write HTML Using Notepad or TextEdit

HTML은 메모장이나 텍스트편집기를 사용합니다.

HTML can be edited by using professional HTML editors like:

  • Microsoft WebMatrix
  • Sublime Text

However, for learning HTML we recommend a text editor like Notepad (PC) or TextEdit (Mac). We believe using a simple text editor is a good way to learn HTML. Follow the 4 steps below to create your first web page with Notepad.

HTML편집기는 전문가가 HTML을 편집하기위해 사용합니다:

  • 마이크로소프트 웹메트릭스
  • 서브라임 텍스트

우리는 메모장이나(pc) 텍스트편집기(Mac)로 배우는 것을 추천합니다. 우리는 간단한 문자 편집기를 사용해서 HTML을 배우는 좋은 방법입니다.


Step 1: Open Notepad

1단계 : 메모장 열기

To open Notepad in Windows 7 or earlier:
Click Start (bottom left on your screen). Click All Programs. Click Accessories. Click Notepad.
To open Notepad in Windows 8 or later:
Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.

일단 윈도우 7에 있는 메모장을 여는방법입니다.:
시작을 눌러서(당신의 화면 왼쪽밑에). 프로그램을 눌러줍니다. 보조를 눌러줍니다. 메모장을 눌러줍니다.
다음은 윈도우 8의 메모장을 여는방법 입니다:
시작 화면에(당신의 화면 아래에 윈도우 표시).메모장을 시작합니다.


Step 2: Write Some HTML

2단계 : 일부의 HTML을 쓴다

Write or copy some HTML into Notepad.

메모장에 HTML의 일부를 복사해서 씁니다.

<!DOCTYPE html>
<html>
<body>

<h1> My First Heading </h1>
		
<p> My first paragraph. <p>

</body>
</html>


Step 3: Save the HTML Page

3단계 : HTML 페이지 저장

Save the file on your computer. Select File > Save as in the Notepad menu.
Name the file “index.html” or any other name ending with html or htm.
UTF-8 is the preferred encoding for HTML files.
ANSI encoding covers US and Western European characters only.

당신의 컴퓨터에 파일을 저장합니다.
메모장의 메뉴에서 파일 > 다른이름으로 저장 을 선택합니다.
파일의 이름의 끝에는 html이나 htm이라고 붙여서 “index.html”이라고 지정 합니다.
UTF-8은 HTML파일에서 선호하는 코드화입니다.
ANSI 코드화는 미국과 유럽에서 사용합니다.

You can use either .htm or .html as file extension. There is no difference, it is up to you.

당신은 확장자명으로 htm이나 html을 둘중 어느 것 으로 사용해도 크게 차이는 없습니다.


Step 4: View HTML Page in Your Browser

4단계 : 당신의 브라우저에서 HTML페이지 보기

Open the saved HTML file in your favorite browser. The result will look much like this:

당신이 저장한 HTML파일을 열어보면 브라우저의 결과는 아래 보이는 것과 같다:

To open a file in a browser, double click on the file, or right-click, and choose open with.

파일을 열어서 브라우저에서 볼려면 파일을 2번클릭이나 오른쪽 클릭하고 열기를 선택합니다.


HTML Basic Examples

HTML 기초 예제

Don’t worry if these examples use tags you have not learned.
You will learn about them in the next chapters.

당신이 태그들에 대해서 배우지 않았어도 걱정하지 마십시오.
당신은 이번 장에서 그것들에 대해서 배우게 될것입니다.

HTML Documents

HTML 문서

All HTML documents must start with a type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.

모든 HTML문서에서는 시작할때 <!DOCUTYPE html>을 선언하는 것이 중요합니다.
HTML문서 자체는 <html>로 시작해서 </html>로 끝납니다.
보여지는 부분은 HTML문서에 <body>와</body>사이입니다.

Example 예

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

HTML Headings

HTML 제목

HTML headings are defined with the <h1> to <h6> tags:

HTML제목은 <h1>부터 <h6>까지의 태그로 정의되어 있습니다.

Example 예

<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>

HTML Paragraphs

HTML 단락

HTML paragraphs are defined with the <p> tag:
HTML단락은 <p>태그와 같이 정의됩니다.

Example

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

HTML링크

HTML links are defined with the <a> tag:  
HTML링크는 <a>와같이 정의됩니다.

Example

<a href="http://www.w3schools.com">This is a link</a>

The link’s destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.

링크는 href속성에 목적지를 명시합니다.
이 속성은 HTML요소에대한 정보를 추가제공 하는데 사용합니다.

HTML Images

HTML그림

HTML images are defined with the tag.
The source file (src), alternative text (alt), and size (width and height) are provided as attributes:

HTML그림은 태그와 같이 정의됩니다.
소스파일은(src), 대신 보여질 글씨는(alt), 그리고 사이즈는(width와height)로 속성을 제공해 줍니다.

Example

<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

You will learn more about attributes in a later chapter.

당신은 다음장에서 속성에대해 더 자세하게 배울것 입니다.


HTML Elements

HTML요소

HTML documents are made up by HTML elements.   
HTML Elements   
HTML elements are written with a start tag, with an end tag, with the content in between:   
<tagname>content</tagname>   

HTML문서는 HTML요소에 의해서 만들어 집니다.  
HTML요소  
HTML요소는 시작태그와 종료태그 사이에 내용을 씁니다. 
<tagname>content</tagname>  

The HTML element is everything from the start tag to the end tag:

My first HTML paragraph.

My first HTML paragraph.

Start tag	Element content	      End tag
<h1>	        My First Heading	</h1>
<p>	        My first paragraph.	</p>
<br>

Some HTML elements do not have an end tag.
일부 HTML요소에는 종료 태그가 없다


Nested HTML Elements

반복적인 HTML요소

HTML elements can be nested (elements can contain elements).
All HTML documents consist of nested HTML elements.
This example contains 4 HTML elements:

HTML요소는 중첩될 수 있습니다.(요소는 요소안에 들어가는게 가능합니다.)
모든 HTML문서는 HTML요소를 반복적으로 되어 있습니다. 이 예제는 4개의 HTML요소 중첩입니다.

Example
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

HTML Example Explained.

HTML 예 설명

The <html> element defines the whole document.    
It has a start tag <html> and an end tag </html>.   
The element content is another HTML element (the <body> element). 

<html>요소는 문서 전체를 의미한다.  
시작태그<html>와 종료태그</html>를 가지고 있습니다.  
다른 하나의 HTML요소는(<body>요소)입니다. 
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>
The <body> element defines the document body.   
It has a start tag <body> and an end tag </body>.  
The element content is two other HTML elements (<h1> and <p>).  

<body>요소는 문서를 정의 하는 일부 입니다.  
그것은 시작태그<body>와 종료태그</body>를 가지고 있습니다.
그 요소 사이에 2개의 다른 HTML요소는(<h1> and <p>)입니다.
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
The <h1> element defines a heading.  
It has a start tag <h1> and an end tag </h1>.  
The element content is: My First Heading. 

그<h1>요소는 제목을 정의합니다.  
그것은 시작태그로<h1>하고 종료태그로</h1>을 가지고 있습니다.  
그 요소의 내용은:My First Heading. 입니다. 
<h1>My First Heading</h1>
The <p> element defines a paragraph.  
It has a start tag <p> and an end tag </p>.  
The element content is: My first paragraph.  

<p>요소는 단락을 의미합니다.
그것은 시작태그<p>와 종료태그</p>를 가지고 있습니다.
그 요소의 내용은: My first paragraph 입니다. 
<p>My first paragraph.</p>

Don’t Forget the End Tag

종료태그를 잊지말아야 합니다

Some HTML elements will display correctly, even if you forget the end tag:
일부의 HTML요소는 종료태그를 잊어버린 경우에도 제대로 표시됩니다.

Example

<html>
<body>

<p>This is a paragraph
<p>This is a paragraph

</body>
</html>

The example above works in all browsers, because the closing tag is considered optional.
Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.

종료태그가 옵션으로 간주되기 때문에 위의 예제는 모든 브라우저에서 작동합니다.
결코 이것을 신뢰하지 말아야 합니다. 당신이 종료태그를 잊어버린 경우에는 오류나 다른 결과가 발생할 수 있습니다.


Empty HTML Elements

빈 HTML요소

HTML elements with no content are called empty elements.   
<br> is an empty element without a closing tag (the <br> tag defines a line break).   
Empty elements can be "closed" in the opening tag like this: <br />.  
HTML5 does not require empty elements to be closed. But if you want stricter validation, or you need to make your document readable by XML parsers, you should close all HTML elements. 

내용없는 HTML요소는 빈요소라고 합니다.   
br은 종료태그가 없는 빈 요소 입니다.  
빈 요소는 여는태그에 닫는 것이 가능합니다.  
HTML5는 닫는 빈 요소를 필요로 하지 않습니다. 하지만 당신이 더 엄격한 확인을 필요로 하거나 파서하여 문서를 읽을 수 있도록 할 필요가있는 경우, 당신은 모든 HTML 요소를 닫아야합니다.

HTML Tip: Use Lowercase Tags

HTML 팁: 소문자 태그 사용

HTML tags are not case sensitive: <P> means the same as <p>.
The HTML5 standard does not require lowercase tags, but W3C recommends lowercase in HTML4, and demands lowercase for stricter document types like XHTML.
At W3Schools we always use lowercase tags.

HTML태그는 대소문자를 구별하지 않습니다: <P> means the same as <p>
HTML5는 대소문자를 구별하여 사용하지 않지만, w3c나 HTML4는 엄격하게 구별하여 사용됩니다.


HTML Attributes

HTML속성


Attributes provide additional information about HTML elements.
속성은 HTML요소에대한 추가적인 정보를 제공합니다.

HTML Attributes

HTML속성

HTML elements can have attributes
Attributes provide additional information about an element
Attributes are always specified in the start tag
Attributes come in name/value pairs like: name=”value”

HTML요소는 속성을 가지고 있습니다.
요소에대한 추가적인 정보에대한 속성을 제공해 줍니다. 속성은 항상 시작태그에 지정됩니다. 이름/값에 대한 속성은 : name=”value”입니다.


The lang Attribute

lang속성

The document language can be declared in the <html> tag.
The language is declared in the lang attribute.
Declaring a language is important for accessibility applications (screen readers) and search engines:

이 문서에서 언어는 html태그에 선언이 가능합니다. 이 언어는 lang속성을 선언합니다.
언어를 선언한다는 것은 필요한 응용프로그램이나 중요한 검색 엔진 입니다. 이 선언한 언어는 검색엔진 애플리케이션에 중요합니다.

<!DOCTYPE html>
<html lang="en-US">
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

The first two letters specify the language (en). If there is a dialect, use two more letters (US).
처음 두문자는 (en)언어를 명시할때 씁니다. 만약 어떤것이 분포해 있으면, 두분자로(US)로 사용합니다.


The title Attribute

제목 속성

HTML paragraphs are defined with the <p> tag.
In this example, the <p> element has a title attribute. The value of the attribute is “About W3Schools”:

HTML단락은 <p>태그로 정의됩니다.
예를들면, <p>요소는 제목 속성을 가지고 있습니다. 그 값은 “About W3Schools” 속성입니다.

Example

<p title="About W3Schools">
W3Schools is a web developer's site.
It provides tutorials and references covering
many aspects of web programming,
including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc.
</p>

When you move the mouse over the element, the title will be displayed as a tooltip.
당신이 마우스를 요소 위에 올리면 그 제목은 말풍선으로 보여지게 됩니다.


The href Attribute

href 속성

HTML links are defined with the <a> tag. The link address is specified in the href attribute:

HTML링크는 <a>태그로 정의됩니다. 그 링크의 주소에 명시되는 것은 href속성 입니다:

Example

<a href="http://www.w3schools.com">This is a link</a>

You will learn more about links and the <a> tag later in this tutorial.  
당신은 더많은 링크와 <a>태그를 다음 튜토리얼에서 배울 것 입니다.

Size Attributes

크기 속성

HTML images are defined with the tag.
The filename of the source (src), and the size of the image (width and height) are all provided as attributes:

HTML이미지는 태그로 정의됩니다.
파일 이름은 소스(src), 그리고 이미지 크기는(높이와 너비)로 제공해주는 속성입니다.

Example

<img src="w3schools.jpg" width="104" height="142">

The image size is specified in pixels: width=”104” means 104 screen pixels wide.
You will learn more about images and the tag later in this tutorial.

그 이미지 크기는 픽셀 단위로 명시됩니다:width=”104” 화면 너비가 104필셀임을 의미합니다.


The alt Attribute

alt 속성

The alt attribute specifies an alternative text to be used, when an HTML element cannot be displayed.
The value of the attribute can be read by “screen readers”. This way, someone “listening” to the webpage, i.e. a blind person, can “hear” the element.

alt속성은 html요소를 사용할 수 없을때 글자를 대신해서 보여줄 때 사용합니다.(그림이 안나올때 문자로 대신 표시할 수 있다)
이 속성값은 스크린 리더에 의해 판독된다. 이런식으로 볼 수 없는 사람은 듣기로 가능합니다.

Example

<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

We Suggest: Always Use Lowercase Attributes

우리의 추천: 항상 소문자 속성을 사용합니다.

The HTML5 standard does not require lower case attribute names.
The title attribute can be written with upper or lower case like Title and/or TITLE.
W3C recommends lowercase in HTML4, and demands lowercase for stricter document types like XHTML.
Lower case is the most common. Lower case is easier to type.
At W3Schools we always use lower case attribute names.

html5는 속성 이름으로 소문자를 사용하는 기준은 없습니다.
문서의 제목 속성을 사용할때 소문자나 대문자로 Title 또는 TITLE로도 가능합니다.
W3C는 권장 HTML4에서 소문자 및 요구 XHTML과 같은 엄격한 문서 형식에 대한 소문자.
소문자가 일반적입니다. 소문자가 입력하기 쉽다. W3S에서 우리는 항상 소문자를 사용하여 속성 이름을 사용하였습니다.


We Suggest: Always Quote Attribute Values

우리의 추천: 항상 속성 값을 그대로 전달합니다.

The HTML5 standard does not require quotes around attribute values.
The href attribute, demonstrated above, can be written as:

HTML5표준은 따옴표 속에 속성값을 사용하지 않습니다.
href속성은 위에서 사용했던거처럼 글씨로 보여주는 것이 가능합니다.:

Example

<a href=http://www.w3schools.com>

W3C recommends quotes in HTML4, and demands quotes for stricter document types like XHTML.
Sometimes it is necessary to use quotes. This will not display correctly, because it contains a space:

W3C…

Example

<p title=About W3Schools>

Using quotes are the most common. Omitting quotes can produce errors.
At W3Schools we always use quotes around attribute values.

따옴표가 가장 일반적입니다. 따옴표를 빠트리면 애러가 발생합니다.
W3Schools는 항상 따옴표로 속성 값을 둘러 쌓이게 사용합니다.


Single or Double Quotes?

작은 따옴표나 큰 따옴표

Double style quotes are the most common in HTML, but single style can also be used.
In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:

HTML에서 가장 일반적이지만 단일의 스타일에도 사용이 가능합니다.
속성값에 큰따옴표가 사용되었으면 작은 따옴표를 사용해야 합니다:

<p title='John "ShotGun" Nelson'>

Or vice versa:
<p title="John 'ShotGun' Nelson">

Chapter Summary

요약

All HTML elements can have attributes
The HTML title attribute provides additional “tool-tip” information
The HTML href attribute provides address information for links
The HTML width and height attributes provide size information for images
The HTML alt attribute provides text for screen readers
At W3Schools we always use lowercase HTML attribute names
At W3Schools we always quote attributes with double quotes

모든 HTML요소는 속성을 가지고 있습니다.
HTML 제목 속성은 추가로 정보를 제공해 줍니다.
HTML은 href속성으로 주소를 링크로 정보를 제공해 줍니다.
HTML 너비와 높이속성은 정보 이미지의 크기를 제공해 줍니다.
HTML alt 속성은 판독하여 글씨를 제공해 줍니다.
W3Schools 우리는 항상 소문자로 HTML 속성이름을 사용합니다.
W3Schools 우리는 항상 속성에 따옴표나 쌍따옴표를 함께 사용합니다.


Test Yourself with Exercises!

Exercise1
Exercise2
Exercise3
Exercise4
Exercise5


HTML Attributes

HTML 속성

Below is an alphabetical list of some attributes often used in HTML:
다음은 자주 HTML에서 사용되는 몇가지 특성의 목록 입니다:

  • alt: Specifies an alternative text for an image
  • disabled: Specifies that an input element should be disabled
  • href: Specifies the URL (web address) for a link
  • id: Specifies a unique id for an element
  • src: Specifies the URL (web address) for an image
  • style: Specifies an inline CSS style for an element
  • title: Specifies extra information about an element (displayed as a tool tip)
  • value: Specifies the value (text content) for an input element.

  • alt: 이미지에 대한 글자를 지정합니다.
  • disabled: 입력 요소를 사용하지 않도록 지정합니다.
  • href: 링크는 웹 주소 URL을 지정합니다.
  • id: 요소는 고유의 id를 지정합니다.
  • src: 이미지의 웹주소 URL을 지정합니다.
  • style: CSS스타일 요소를 지정합니다.
  • title: 부가적인 정보를 요소에 지정합니다.(추가 정보가 보여집니다)
  • value: 요소에 넣을 값을 지정합니다.

A complete list of all attributes for each HTML element, is listed in our: HTML Tag Reference.
각 HTML요소에 대한 모든 속성의 전체 목록은 나열되어 있는 HTML태그를 참조합니다.



HTML Headings