[HTML] DOCTYPE

์†Œ์ด๋Žยท2023๋…„ 9์›” 4์ผ
0

My HTML

๋ชฉ๋ก ๋ณด๊ธฐ
1/7
post-thumbnail

๐ŸŒˆ ํ•™์Šต์„ ์œ„ํ•ด Must-Know-About-Frontend์—์„œ ๊ฐ€์ ธ์˜จ ๋‚ด์šฉ์„ ์ˆ˜์ •, ์ถ”๊ฐ€ํ•˜์—ฌ ์ž‘์„ฑํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๊ธฐ์กด ๋‚ด์šฉ๊ณผ ๋Œ€๋ถ€๋ถ„ ์œ ์‚ฌํ•˜๋ฉฐ Summary ๋ถ€๋ถ„์€ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Summary

์„ค๋ช…
์นดํ…Œ๊ณ ๋ฆฌ๋ฌธ์„œ ํ˜•์‹ ์ •์˜
DTDDocument Type Definition
๋ฌธ์„œ ํ˜•์‹์„ ์ •์˜ํ•˜๋Š” ๊ฒƒ
DOCTYPEDTD๋ฅผ ์œ„ํ•œ HTML ๋ฌธ์„œ์˜ ์„ ์–ธ๋ฌธ
์›น ๋ธŒ๋ผ์šฐ์ €์—๊ฒŒ ํ˜„์žฌ ๋ฌธ์„œ์˜ ์œ ํ˜•๊ณผ ๋ฒ„์ „์„ ์•Œ๋ ค์คŒ
ex ) <!DOCTYPE html>



Document Type์˜ ์•ฝ์ž๋กœ, HTML์ด ์–ด๋–ค ๋ฒ„์ „์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ๋Š”์ง€ ๋ฏธ๋ฆฌ ์„ ์–ธํ•˜์—ฌ ์›น๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋‚ด์šฉ์„ ์˜ฌ๋ฐ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ๊ฒƒ ์ด๋‹ค. <!DOCTYPE> ์œผ๋กœ ์„ ์–ธํ•˜๋Š”๋ฐ ์ด๊ฑธ ํ•ด์ฃผ์ง€ ์•Š์œผ๋ฉด ํ˜ธํ™˜ ๋ชจ๋“œ(quirks mode) ๋กœ ๋™์ž‘ํ•œ๋‹ค. ํ˜ธํ™˜ ๋ชจ๋“œ์˜ ๊ฒฝ์šฐ ๊ฐ ๋ธŒ๋ผ์šฐ์ €๋งˆ๋‹ค ๋ฌธ์„œ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฐฉ์‹์ด ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ํฌ๋กœ์Šค ๋ธŒ๋ผ์šฐ์ง• ์ด์Šˆ๊ฐ€ ํ›จ์”ฌ ์‹ฌํ•ด์ง€๊ฒŒ ๋œ๋‹ค.

DTD(Document Type Definition)

DTD(Document Type Definition)๋ž€ ๋ฌธ์„œ ํ˜•์‹์„ ์ •์˜ํ•ด๋†“์€ ๊ฒƒ์œผ๋กœ DOCTYPE์„ ๋ช…์‹œํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค. ์ฆ‰, HTML ๋ฌธ์„œ๊ฐ€ ์–ด๋–ค ๋ฌธ์„œ ํ˜•์‹์„ ๋”ฐ๋ฅด๋Š”์ง€ DOCTYPE์—์„œ DTD๋ฅผ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

์˜ˆ์‹œ๋กœ ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฒƒ๋“ค์ด ์žˆ๊ณ  W3C Recommended list of Doctype declarations ์—์„œ ๋”์šฑ ์ž์„ธํ•˜๊ฒŒ ํ™•์ธ ๊ฐ€๋Šฅํ•˜๋‹ค.

  • XHTML 1.1
  • XHTML 1.0
    • Strict DTD
    • Transitional DTD
    • Frameset DTD
  • HTML 4.01
    • Strict DTD
    • Transitional DTD
    • Frameset DTD
  • HTML 5

HTML 5์˜ DTD๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ตœ์‹  ์›น ๊ธฐ์ˆ ๊ณผ ์›น ํ‘œ์ค€์„ ๋”ฐ๋ฅด๋ฉฐ, ๋ชจ๋˜ํ•œ ์›น ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๊ธฐ๋Šฅ๊ณผ ๋„๊ตฌ๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๋”ฐ๋ผ์„œ, ํ˜„ ์‹œ์ ์—์„ , HTML 5์˜ DTD๋กœ DOCTYPE์„ ๋ช…์‹œํ•˜๋Š” ๊ฒƒ์ด ์ œ์ผ ๋ฐ”๋žŒ์งํ•˜๋‹ค.

<!DOCTYPE html>

์ฐธ๊ณ 

0๊ฐœ์˜ ๋Œ“๊ธ€