HTML Basics

1. HTML 5์˜ ํƒ„์ƒ๊ณผ ์˜๋ฏธ

HTML์ด๋ž€

  • Hyper Text Markup Language์˜ ์•ฝ์ž

    • Hyper Text

      • ๊ฐ ๋ฌธ์„œ๋งˆ๋‹ค ์—ฐ๊ฒฐ๋˜๋Š” ๋งํฌ๋“ค์„ ๋ชจ๋‘ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ํ˜•ํƒœ ( ๋‹ค์–‘ํ•œ ๋ฌธ์„œ๋“ค๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋Š” ํ˜•ํƒœ)

      • HTTP

        : Hyper Text๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” ํ˜•ํƒœ

    • Markup

      • ๋ฌธ์„œ์˜ ๊ตฌ์กฐ๋ฅผ ์žก๋Š” ์ž‘์—…์„ ํ•˜๋Š” ๊ฒƒ

    • Markup Language๋Š” ์ปดํ“จํ„ฐ ์–ธ์–ด๋ผ๋ฉด ๋‹น์—ฐํžˆ ์žˆ์–ด์•ผํ•  ์—ฐ์‚ฐ ๊ธฐ๋Šฅ์ด ์—†๊ณ , ๋‹จ์ˆœํžˆ content์˜ ์„ฑ๊ฒฉ์„ ํ‘œ์‹œํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ๋งŒ ์žˆ์Œ

    • Web์šฉ content (๊ธ€/๊ทธ๋ฆผ) ๋“ฑ์˜ ๊ตฌ์กฐ๋ฅผ ์ง€์ •ํ•˜๋Š” ์ปดํ“จํ„ฐ ์–ธ์–ด

  • Web server์— ์ €์žฅ๋˜์–ด Client web browser์˜ ์š”๊ตฌ์— ๋”ฐ๋ผ ๋ถˆ๋ ค์ง€๋Š” ๋ฌธ์„œ

  • Web browser์— ๋ถˆ๋ ค์ง„ HTML์€ web browser์— ์˜ํ•ด ํ•ด์„๋˜์–ด ๋‚ด์šฉ์ด ํ™”๋ฉด์— ๋ณด์—ฌ์ง

HTML ํƒ„์ƒ๊ณผ ๋ฐœ์ „

  • 1990๋…„ WWW (World Wide Web) ๊ณผ ํ•จ๊ป˜ ํƒ„์ƒ

  • ์›น์˜ ๋ฐœ์ „์œผ๋กœ ์›น ๋ธŒ๋ผ์šฐ์ €์˜ ์ค‘์š”์„ฑ ํ™•๋Œ€

  • โ€˜๋„ท์Šค์ผ€์ดํ”„ ๋„ค๋น„๊ฒŒ์ดํ„ฐโ€™์™€ โ€˜๋งˆ์ดํฌ๋กœ์†Œํ”„ํŠธ ์ธํ„ฐ๋„ท ์ต์Šคํ”Œ๋กœ๋Ÿฌโ€™์˜ ์‹œ์žฅ ์ ์œ ์œจ ์ „์Ÿ์œผ๋กœ HTML๊ณผ C SS์˜ ๋น„ํ‘œ์ค€ ์‹ฌํ™”

  • ์ƒˆ๋กœ์šด ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋“ฑ์žฅํ•˜๋ฉด์„œ ์›น์˜ ํ‘œ์ค€ํ™” ๋…ผ์˜

  • ์›น ํ‘œ์ค€์„ ๊ฐœ๋ฐœํ•˜๊ณ  ๋…ผ์˜ํ•˜๋ฉฐ ์ œ์ •ํ•˜๋Š” W3C(World Wide Web Consortium)

  • 1997๋…„ W3C HTML3.2 ๊ถŒ๊ณ  โ€“ ์‹œ์žฅ ์š”๊ตฌ์— ์˜ํ•ด ๋น„ํ‘œ์ค€ HTML ํฌํ•จ

  • 1999๋…„ HTML 4.01 ๊ถŒ๊ณ  โ€“ ์‹œ์žฅ ์š”๊ตฌ์— ์˜ํ•ด ๋‹ค์–‘ํ•œ ๋ฒ„์ „ ๋“ฑ์žฅ

  • 2000๋…„ XHTML ๊ถŒ๊ณ  โ€“ XML์˜ ์—„๊ฒฉํ•จ์„ ์ฃผ์š” ๋‚ด์šฉ์œผ๋กœ ํ•œ ์›น ํ‘œ์ค€

  • W3C๋Š” XHTML2 ๊ฐœ๋ฐœ ์ถ”์ง„ ํ•˜๋‹ค ๋Œ์—ฐ HTML5๋กœ ๋ฐฉํ–ฅ ์ „ํ™˜

์ตœ๊ทผ Web ๋™ํ–ฅ

  • Ajax

    : JavaScript๋ฅผ ์ด์šฉํ•˜์—ฌ web server์™€ ๋™๊ธฐํ™” ๋œ web์˜ ํ•œ๊ณ„ ๊ทน๋ณต

  • Web 2.0

    : ์‚ฌ์šฉ์ž์˜ ๋Šฅ๋™์ ์ธ ์ฐธ์—ฌ์™€ ํŽธ์˜์„ฑ์ด ๊ทน๋Œ€ํ™” ๋œ web์„ ํ†ต์นญ

HTML5์˜ ํƒ„์ƒ

๊ธฐ์กด HTML์˜ ํ•œ๊ณ„

  • ์›น ๊ธฐ๋ฐ˜ ์‚ฌ์—…๊ณผ ๊ธฐ์ˆ ์˜ ๋ฐœ์ „์„ ๋ชป ๋”ฐ๋ผ๊ฐ„ HTML

  • ๋™์ ์ธ ์›น์„ ์œ„ํ•œ ํ‘œ์ค€ํ™” ๋œ ๊ธฐ์ˆ ์„ ์š”๊ตฌ

  • W3C์˜ XHTML2๋กœ์˜ ๋ฐœ์ „ ์˜ˆ๊ณ 

WHATWG((Web Hypertext Application Technology Working Group) ํƒ„์ƒ

  • ์‹œ์žฅ ์š”๊ตฌ์— ๋ถ€์‘ํ•˜์ง€ ๋ชปํ•˜๋Š” W3C์— ์‹ค๋งํ•œ ์›น ๊ด€๋ จ ์—…์ฒด์™€ ๋‹จ์ฒด๊ฐ€ ์ž์ฒด์ ์œผ๋กœ ๋งŒ๋“  ์›Œํ‚น ๊ทธ๋ฃน

  • ์›น ๊ธฐ์ˆ ๊ณผ ์‹œ์žฅ์˜ ์š”๊ตฌ๋ฅผ ๋ถ„์„ํ•˜์—ฌHTML5 ๋ช…์„ธ์„œ ์ž‘์—… ์ฐฉ์ˆ˜

W3C์˜ HTML5 ์ˆ˜์šฉ

  • 2008๋…„ W3C HTML5 ์ดˆ์•ˆ ๋ฐœํ‘œ

  • 2009๋…„ XHTML2 ๊ฐœ๋ฐœ ์ค‘๋‹จ

  • 2014๋…„ XHTML5 ๊ถŒ๊ณ  ์˜ˆ์ •

HTML5์˜ ํŠน์ง•

  • ๊ธฐ์กด HTML๊ณผ์˜ ํ˜ธํ™˜์„ฑ ์œ ์ง€

  • ์‹ค์šฉ์  ์„ค๊ณ„

    : ๋Š์Šจํ•œ ๋ฌธ๋ฒ•, ํšจ์œจ์ ์ธ ์ถ”๊ฐ€ ์š”์†Œ, ์•ˆ์ „ํ•œ ๋ณด์•ˆ

  • ํ‘œํ˜„๊ณผ ๋‚ด์šฉ์˜ ์™„๋ฒฝํ•œ ๋ถ„๋ฆฌ

  • ํ”Œ๋Ÿฌ๊ทธ์ธ ์—†์ด ๊ฐ์ข… ๋ฏธ๋””์–ด ์ฒ˜๋ฆฌ ๋ฐ ๋™์ ์ธ ์ž‘๋™: ์บ”๋ฒ„์Šค

  • ์ตœ์‹  ์›น ๊ธฐ์ˆ  ์ˆ˜์šฉ

    : ์ง€์˜ค๋กœ์ผ€์ด์…˜, ์›น์†Œ์ผ“, ์›น์Šคํ† ๋ฆฌ์ง€, ์›น์›Œ์ปค ๋“ฑ

2. HTML5 ์‹œ์ž‘ํ•˜๊ธฐ

Doctype ์ง€์ •ํ•˜๊ธฐ

  • HTML์€ ์—ฌ๋Ÿฌ ๋ฒ„์ „์ด ์กด์žฌํ•˜๋ฏ€๋กœDoctype์„ ๋ช…์‹œํ•ด์•ผ ํ•œ๋‹ค.

  • ๊ธฐ์กด Doctype ์€ ๋งค์šฐ ๊ธธ๊ณ  ๋ณต์žกํ•œ DTD๋ฅผ ๋ช…์‹œํ•ด์•ผ ํ–ˆ์—ˆ๋‹ค.

  • HTML5์˜ ์‹ค์šฉ์„ฑ ์›์น™์œผ๋กœ ์ธํ•ด ์งง์•„์กŒ๋‹ค.

 <!DOCTYPE html>

HTML ์ž‘์„ฑ ๊ทœ์น™

  • HTML์˜ ๋งˆํฌ์—… ๋ช…๋ น์€ ์š”์†Œ๋ผ ๋ถ€๋ฅธ๋‹ค.

  • HTML์€ ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š๋Š”๋‹ค.

  • ์š”์†Œ๋Š” ์ฝ˜ํ…์ธ ์™€ ๊ตฌ๋ถ„์„ ์œ„ํ•ด์„œ ๊บฝ์‡ ๋กœ ๋‘˜๋Ÿฌ์‹ผ๋‹ค. โ€“ ํƒœ๊ทธ

<p>, <a>, <div>
  • ์‹œ์ž‘ํƒœ๊ทธ์™€ ๋งˆ์นจํƒœ๊ทธ๋กœ ์š”์†Œ์˜ ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•œ๋‹ค.

<p>์ด๊ฒƒ์€ ๋‹จ๋ฝ ์ž…๋‹ˆ๋‹ค.</p>
  • ๋งˆ์นจํƒœ๊ทธ๊ฐ€ ์—†์ด ๋‹จ๋…์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ์š”์†Œ๋„ ์žˆ๋‹ค.

<br>, <img>, <meta>
  • ์š”์†Œ์˜ ์†์„ฑ์€ ์†์„ฑ๋ช… = โ€œ์†์„ฑ๊ฐ’โ€ ํ˜•์‹์œผ๋กœ ๊ธฐ์ˆ ํ•œ๋‹ค.

<img src=โ€img/logo.jpgโ€ alt=โ€Company Logoโ€>

HTML์˜ ๊ตฌ์กฐ

<!Doctype html>
<html>
 <head>
        <title>Sample Page</title>
 </head>
 <body>
        <H1>
            Welcome, y'all!
        </H1>
 </body>
</html>
  • <html>์€ HTML ์ฝ”๋“œ ์ „์ฒด๋ฅผ ๊ฐ์‹ผ๋‹ค.

  • HTML์€ <head>์™€ <body> ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋‰œ๋‹ค.

  • <head>๋Š” ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ์™€ ์Šคํฌ๋ฆฝ, CSS๋“ฑ์ด ์œ„์น˜ํ•œ๋‹ค. (์™ธ๋ถ€ ํŒŒ์ผ ์—ฐ๊ฒฐ)

  • <body>๋ถ€๋ถ„์€ ์ฝ˜ํ…์ธ ๊ฐ€ ๋‹ด๊ธฐ๋Š” ๊ณณ์œผ๋กœ ์›น ๋ธŒ๋ผ์šฐ์ €์— ํ‘œ์‹œ๋œ๋‹ค.

3. <head> ์„ค์ •

ํƒ€์ดํ‹€ ์ง€์ •

  • HTML ํŒŒ์ผ์˜ ์ œ๋ชฉ์œผ๋กœ ์›น ๋ธŒ๋ผ์šฐ์ € ํƒ€์ดํ‹€์— ๋‚˜ํƒ€๋‚œ๋‹ค.

<title>์›น ํŽ˜์ด์ง€ ์ œ๋ชฉ</title>

๋ฌธ์ž ์ธ์ฝ”๋”ฉ

  • ์‚ฌ์šฉํ•˜๋Š” ํ…์ŠคํŠธ ์—๋””ํ„ฐ์˜ ๋ฌธ์ž ์ธ์ฝ”๋”ฉ๊ณผHTML์˜ ๋ฌธ์ž ์ธ์ฝ”๋”ฉ๊ณผ ๋™์ผํ•ด์•ผ ์›น ๋ธŒ๋ผ์šฐ์ €์—์„œ ์˜ณ๋ฐ”๋ฅด ๊ฒŒ ํ‘œ์‹œ๋œ๋‹ค.

  • ์œ ๋‹ˆ์ฝ”๋“œ์ธ UTF-8๋กœ ์ง€์ •ํ•œ๋‹ค.

๋ฉ”ํƒ€๋ฐ์ดํ„ฐ

  • ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ๊ธฐ์ˆ  ํ•˜๋ฉด ์›น ๊ฒ€์ƒ‰์— ์œ ๋ฆฌํ•˜๋‹ค.

  • HTML์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๊ธฐ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.

๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ๊ธฐ์ˆ  ๋ฐฉ๋ฒ•

<meta name="description"content="HTML5 ์™€ Javascript ํ•™์Šต์ฝ˜ํ…์ธ  ">
<meta name="keywords" content="HTML5, CSS, JavaScript">
<meta name="author"content="Lee HaeBum">
<meta name=โ€copyrightโ€ content=โ€ยฉ2012 Lee HaeBumโ€>
<meta name=โ€reply-toโ€ content=gomtomi@imacca.com>
<meta name=โ€dateโ€ content=โ€2012-05-30T12:35:20+09:00โ€>

๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ์ƒˆ๋กœ์šด ๊ทœ์•ฝ, Open Graph Protocol

  • HTML ๋ฌธ์„œ์˜ meta data๋ฅผ ํ†ตํ•ด ๋ฌธ์„œ์˜ ์ •๋ณด ์ „๋‹ฌ

  • Facebook์—์„œ ๋งŒ๋“ค์—ˆ์œผ๋ฉฐ, meta ์ •๋ณด์— ํ•ด๋‹นํ•˜๋Š” ์ œ๋ชฉ, ์„ค๋ช… ๋“ฑ์„ ์“ธ ์ˆ˜ ์žˆ๋„๋ก ์ •์˜

ex)

<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
</head>
...
</html>

The following properties are optional for any object and are generally recommended:

  • og:audio - A URL to an audio file to accompany this object.

  • og:description - A one to two sentence description of your object.

  • og:determiner - The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto). If auto is chosen, the consumer of your data should chose between "a" or "an". Default is "" (blank).

  • og:locale - The locale these tags are marked up in. Of the format language_TERRITORY. Default is en_US.

  • og:locale:alternate - An array of other locales this page is available in.

  • og:site_name - If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb".

  • og:video - A URL to a video file that complements this object.

Semantic Tag

  • HTML์—์„œ ์˜๋ฏธ๋ก ์  ์š”์†Œ๋ฅผ ๋‹ด์€ tag๋“ค์˜ ๋“ฑ์žฅ - <div>๋ฅผ ์“ฐ์ง€ ์•Š๋Š”๋‹ค!

  • ๋Œ€ํ‘œ์ ์ธ Tag๋“ค

    • header: ๋ฌธ์„œ ์ „์ฒด๋‚˜ section์˜ header (๋จธ๋ฆฟ๋ง ๋ถ€๋ถ„)

    • nav: navigation

    • aside: side์— ์œ„์น˜ํ•œ ๊ณต๊ฐ„, main content์™€ ๊ด€๋ จ์ด ์ ์€ content

    • section: ๋ฌธ์„œ, page, site ์•ˆ์—์„œ ๋…๋ฆฝ์ ์œผ๋กœ ๊ตฌ๋ถ„๋˜๋Š” ์˜์—ญ

    • footer: ๋ฌธ์„œ ์ „์ฒด๋‚˜ section์˜ footer (๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„)

  • ๊ฐœ๋ฐœ์ž ๋ฐ ์‚ฌ์šฉ์ž ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๊ฒ€์ƒ‰์—”์ง„ ๋“ฑ์— ์˜๋ฏธ ์žˆ๋Š” ์ •๋ณด์˜ ๊ทธ๋ฃน์„ tag๋กœ ํ‘œํ˜„

  • ๋‹จ์ˆœํžˆ ๊ตฌ์—ญ์„ ๋‚˜๋ˆ„๋Š” ๊ฒƒ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง€๋Š” tag๋“ค์„ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•œ ๋…ธ๋ ฅ

  • Non-semantic ์š”์†Œ๋Š” div, span ๋“ฑ์ด ์žˆ์œผ๋ฉฐ, h1, table tag๋“ค๋„ semantic tag๋กœ ๋ณผ ์ˆ˜ ์žˆ์Œ

  • ๊ฒ€์ƒ‰ ์—”์ง„ ์ตœ์ ํ™” (SEO : Search Engine Optimizaito) ๋ฅผ ์œ„ํ•ด์„œ๋Š” meta tag, semantic tag๋“ฑ์„ ํ†ตํ•œ markup์„ ํšจ๊ณผ์ ์œผ๋กœ ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ!

4. ์™ธ๋ถ€ ํŒŒ์ผ ์—ฐ๊ฒฐ

  • HTML๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉ๋˜๋Š” CSS์™€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๋‹ค๋ฅธ ํŒŒ์ผ๋กœ ๋ถ„๋ฆฌํ•จ์ด ์›์น™์ด๋‹ค.

  • ์™ธ๋ถ€ CSS ํŒŒ์ผ ์—ฐ๊ฒฐ

<link rel=โ€stylesheetโ€ href=โ€css/style.cssโ€>
  • ์™ธ๋ถ€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ ์—ฐ๊ฒฐ

<script src="js/script.js"></script>

HTML5์—์„œ ๊ธฐ์กด HTML๊ณผ ๋‹ฌ๋ผ์ง„ meta์š”์†Œ์™€ Empty ์š”์†Œ๋Š”?

  • meta ์š”์†Œ๋Š” ์ง€๊ธˆ๊นŒ์ง€์˜ HTML์š”์†Œ์™€ ๋‹ค๋ฅด๊ฒŒ ์‹œ์ž‘ ์š”์†Œ๋งŒ์„ ๊ฐ€์ง€๊ณ  ๋งบ์Œ ์š”์†Œ๋Š” ์กด์žฌํ•˜์ง€ ์•Š์Œ

  • ๊ธฐ์กด HTML ์š”์†Œ๊ฐ€ web browser์— ํ•ด๋‹น content๊ฐ€ ์–ด๋–ค ๊ตฌ์กฐ์™€ ์˜๋ฏธ๋ฅผ ๊ฐ–๋Š”์ง€ ์•Œ๋ ค์ฃผ๋Š” ์—ญํ• ์„ ํ–ˆ๋‹ค๋ฉด meta ์š”์†Œ๋Š” web browser์—๊ฒŒ ๋ฌธ์„œ ์ •๋ณด๋ฅผ ์•Œ๋ ค์ฃผ๋Š” ์—ญํ• ์„ ํ•จ

  • ์ผ๋ฐ˜์ ์ธ HTML ์š”์†Œ๊ฐ€ ๋‚ด์šฉ์„ ๊ฐ์‹ธ๋Š” ํ˜•์‹์ด๋ผ๋ฉด meta ์š”์†Œ๋Š” ์†์„ฑ๊ณผ ์†์„ฑ ๊ฐ’์˜ ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ์„ ๋ฟ ๋‚ด์šฉ์„ ๊ฐ์‹ธ๋Š” ๊ฒƒ์€ ์•„๋‹˜

    • ๊ทธ๋ž˜์„œ ๋‚ด์šฉ์„ ๊ฐ€์ง€๊ณ  ์žˆ์ง€ ์•Š์€ ์š”์†Œ, ์ฆ‰ Empty ์š”์†Œ๋ผ๊ณ  ๋ถ€๋ฆ„

    • Empty ์š”์†Œ์—๋Š” img, area, br, hr, input ๋“ฑ์ด ์žˆ์Œ

Last updated