HTML

HTML


~์›น์€ ์–ธ์–ด๋“ค๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค. ๊ฐ€์žฅ ํฌ๊ฒŒ 3๊ฐ€์ง€๋กœ ๋‚˜๋ˆ„๋ฉด, HTML, CSS, JavaScript๊ฐ€ ์žˆ๋‹ค.

HTML: ๋ผˆ๋Œ€, CSS: ๊ทผ์œก, JavaScript: ๋‡Œ

HTML : Hypertest Markup Language โ€“> ๋ธŒ๋ผ์šฐ์ €์—๊ฒŒ ์ปดํ“จํ„ฐ์˜ ์–ธ์–ด๋กœ content์— ๋Œ€ํ•ด ์•Œ๋ ค์ฃผ๋Š” ๊ฒƒ

๋” ๋งŽ์€ tag์™€ attribute์— ๋Œ€ํ•ด ์•Œ๊ณ  ์‹ถ๋‹ค๋ฉด MDN์„ ์ด์šฉํ•˜์ž!!




์ œ๋ชฉ Tag

  • ์ œ๋ชฉ์„ ์„ค์ •ํ•ด์ฃผ๋Š” ํƒœ๊ทธ๋กœ ์ˆซ์ž๊ฐ€ ์ปค์งˆ์ˆ˜๋ก ๊ธ€์”จ ํฌ๊ธฐ๊ฐ€ ์ž‘์•„์ง„๋‹ค.
<h1></h1>
<h2></h2>
<h3></h3>
<h4></h4>
<h5></h5>
<h6></h6>



ordered list / unordered list Tag

  • ๊ฐ content๋ฅผ ์ •๋ ฌํ•ด์ฃผ๋Š” ์—ญํ• ์„ ํ•œ๋‹ค.
  • ordered๋Š” ์ˆœ์„œ๋ฅผ ํ‘œ์‹œํ•˜๊ณ  unordered๋Š” ์ˆœ์„œ๋ฅผ ํ‘œ์‹œํ•˜์ง€ ์•Š๋Š”๋‹ค.
<ol>
  <li>beer</li>
  <li>kimchi</li>
  <li>meat</li>
  <li>milk</li>
</ol>

<ul>
  <li>beer</li>
  <li>kimchi</li>
  <li>meat</li>
  <li>milk</li>
</ul>



anchor Tag & Image Tag

  • ํƒœ๊ทธ๋Š” ๊ฐ๊ฐ ์†์„ฑ (attribute)๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ๋‹ค.
  • href : http reference๋ผ๊ณ  ํ•˜๋ฉฐ ํด๋ฆญ ์‹œ ๋‹ค๋ฅธ ์‚ฌ์ดํŠธ๋กœ ๋„˜๊ฒจ์ค€๋‹ค.
  • taget : ๊ธฐ๋ณธ๊ฐ’์€ self์ด๊ณ , _blank๋ฅผ ๋ˆ„๋ฅผ ๋• ์ƒˆ ํƒญ์—์„œ ๋งํฌ๊ฐ€ ์—ด๋ฆฌ๋„๋ก ๋งŒ๋“ค์–ด์ค€๋‹ค.
  • img : ๋‹ซ๋Š” ํƒœ๊ทธ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” โ€˜์ž์ฒด ํƒœ๊ทธโ€™ ์ด๋‹ค. src์— ์ฃผ์†Œ๋ฅผ ๋„ฃ์œผ๋ฉด ๊ทธ ์ด๋ฏธ์ง€ ์ž์ฒด๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค.
<h1>Hello!</h1>
<a href="http://google.com" target="_blank"> go to google</a>
<img
  src="https://encrypted-tbn0.gstatic.com/images?
  q=tbn:ANd9GcSQfPaD3prMPLL_d-3WsNInzcjQFSjoTU5tmmrRi34XBsPpR75qV
  -Z18qQcrCVLoSYcJcs&usqp=CAU"
  alt=""
/>
  • Image๋Š” ์™ธ๋ถ€ ๋งํฌ๊ฐ€ ์•„๋‹Œ ๋กœ์ปฌ์„ ํ†ตํ•ด์„œ๋„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋‹ค. (๊ฐ™์€ ํด๋”์— ์žˆ์–ด์•ผ ํ•œ๋‹ค.)

screenshot1

html rule / head, body role

  • html ๋ฌธ์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ทœ์น™์„ ๊ฐ€์ง„๋‹ค.
    1. ๊ฐ€์žฅ ๋จธ๋ฆฌ๋ง์— DOCTYPE html์„ ์ ์–ด์คŒ์œผ๋กœ์จ html ๋ฌธ์„œ๋ผ๋Š” ๊ฒƒ์„ ๋ช…์‹œํ•ด์ค€๋‹ค.
    2. html ๋‚ด๋ถ€์—๋Š” head์™€ body ๋‘๊ฐ€์ง€๋กœ ๋‚˜๋‰œ๋‹ค. head๋Š” ์›น์‚ฌ์ดํŠธ์˜ ํ™˜๊ฒฝ / ๋ณด์ด์ง€ ์•Š๋Š” ๊ณณ์„ ๋งŒ๋“ค์–ด์ค€๋‹ค. body๋Š” ์›น์‚ฌ์ดํŠธ์—์„œ ๋ณด์—ฌ์ง€๋Š” ๊ณณ์„ ๋งŒ๋“ ๋‹ค.
    3. head๋‚ด์— ์ถœ๋ ฅ์„ ์‹œํ‚ฌ ์ˆœ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ css, javascript๋ฅผ ์ด์šฉํ•  ๋•Œ ์˜ค๋ฅ˜๋ฅผ ๋‚ผ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ head์—์„  ์ถœ๋ ฅํ•˜์ง€ ๋ง์ž.

head์™€ meta tag

  • meta ํƒœ๊ทธ์—์„œ meta๋ž€? ๋ถ€๊ฐ€์ ์ธ ์ •๋ณด๋ฅผ ๋œปํ•œ๋‹ค.
  • meat ํƒœ๊ทธ๋Š” self-closing ํƒœ๊ทธ์ด๋‹ค.
  • meta description์„ ํ†ตํ•ด ๋ถ€๊ฐ€์„ค๋ช…์„ ์•Œ๋ ค์ค€๋‹ค. โ€“> ๊ฒ€์ƒ‰ ์—”์ง„์ด ๊ฒ€์ƒ‰ํ•  ๋•Œ ์ด ๋ถ€๋ถ„์„ ์ฐพ๋Š”๋‹ค. & title๋„ ๊ทธ๋ ‡ ๋‹ค.
  • lang : ๊ฒ€์ƒ‰ ์—”์ง„์—๊ฒŒ ์šฐ๋ฆฌ๊ฐ€ ์–ด๋–ค ์–ธ์–ด๋ฅผ ์“ฐ๋Š” ์ง€ ์•Œ๋ ค์ค€๋‹ค.
  • head๋Š” ๋ธŒ๋ผ์šฐ์ €์—๊ฒŒ ๋‚˜์˜ ์‚ฌ์ดํŠธ๊ฐ€ ์–ด๋–ป๊ฒŒ ๋ณด์ด๋Š” ์ง€ ์•Œ๋ ค์ฃผ๋Š” ๊ณณ์ด๋‹ค. ๋”ฐ๋ผ์„œ ์–ด๋–ค ๋ธŒ๋ผ์šฐ์ €์—์„œ ๋‚˜์˜ ์‚ฌ์ดํŠธ๋ฅผ ์ฐพ๊ธฐ์œ„ํ•ด head๋ฅผ ๋จผ์ € ์‚ดํ”ผ๊ณ , ๊ฐ ๋ธŒ๋ผ์šฐ์ €, ์•ฑ๋งˆ๋‹ค ๊ทœ์น™์ด ์žˆ๋‹ค. ex) Kakao : og:image

  • link์—์„œ rel ์†์„ฑ์€ ํ™ˆํŽ˜์ด์ง€์˜ ์•„์ด์ฝ˜์„ ๋‚˜ํƒ€๋‚ด์ฃผ๊ณ  title์€ ํ™ˆํŽ˜์ด์ง€์˜ ์ œ๋ชฉ description์€ ๊ฒ€์ƒ‰ํ–ˆ์„ ๋•Œ ๋ถ€๊ฐ€์„ค๋ช…์œผ๋กœ ๋‚˜์˜ค๊ฒŒ ๋œ๋‹ค. screenshot2
<!DOCTYPE html>
<html lang="en">
  <head>
    <link
      rel="shortcut icon"
      type="image/x-icon"
      href="https://www.naver.com/favicon.ico?1"
    />
    <meta charset="UTF-8" />
    <meta name="description" content="hi hihihiihihi" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>hello my first homepage</title>
  </head>
  <body>
    <h1>Hello</h1>
    <a href="http://google.com" target="_blank">oh,, shit</a>
  </body>
</html>



Form Tag

  • ๋‹ค์Œ๊ณผ ๊ฐ™์ด form ๋‚ด๋ถ€์— input์„ ๋„ฃ์–ด ๋‹ค์–‘ํ•œ ํ‘œํ˜„์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • input ์š”์†Œ๋Š” ๋‹ค์–‘ํ•œ attribute๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค. (MDN ์ฐธ์กฐ) ** input์˜ attribute์ธ โ€˜requiredโ€™์˜ ์šฉ๋„๋Š” true, false๋ฅผ ๊ฒ€์ฆํ•  ๋•Œ ์“ด๋‹ค. ** input์˜ ์šฉ๋„, ์“ฐ๋Š” ๋ฒ•์€ MDN ๊ฒ€์ƒ‰์„ ์ด์šฉํ•˜์ž !!
<!DOCTYPE html>
<html lang="kr">
  <head>
    <title>Home - My first website.</title>
  </head>
  <body>
    <form>
      <input required placeholder="name" type="text" name="" id="" />
      <input required placeholder="first" type="text" name="" id="" />
      <input required placeholder="second" type="text" name="" id="" />
      <input required placeholder="Password" type="password" name="" id="" />
      <input type="submit" value="Create Account" />
    </form>
  </body>
</html>



More Tags and IDs

  • id๋Š” ํƒœ๊ทธ ํ•˜๋‚˜ ๋‹น ํ•˜๋‚˜๋งŒ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋Š” ๊ณ ์œ ๊ฐ’์ด๋‹ค.
  • css๋Š” id๋ฅผ ์ด์šฉํ•ด์„œ ์Šคํƒ€์ผ์„ ๋งŒ๋“ค์–ด์ค€๋‹ค. label ๋˜ํ•œ id๋ฅผ ๊ฐ€์ ธ์™€์„œ ์ง€์€ ๊ฒƒ, label์„ ํด๋ฆญํ•˜๋ฉด ์ปค์„œ๊ฐ€ ์˜ฌ๋ผ์˜จ๋‹ค.
<body>
    <form>
      <label for="profile">Profile Photo</label>
      <input id="profile" required placeholder="name" type="text" />

      <label for="first-name">First Name</label>
      <input id="first-name" required placeholder="first" type="text" />

      <label for="second-name">Second Name</label>
      <input id="second-name" required placeholder="second" type="text" />

      <label for="password">Password</label>
      <input id="password" required placeholder="Password" type="password" />

      <label for="website">Website</label>
      <!-- <input id="website" required placeholder="Website" type="url" /> -->
      <input id="website" required placeholder="Website" type="email" />

      <input type="submit" value="Create Account" />
    </form>
  </body>



Semantic HTML

  • ์•„๋ฌด๋Ÿฐ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์ง€ ์•Š์ง€๋งŒ box๋ฅผ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๊ธฐ๋Šฅ ex) <div> , , <p>
  • div๋Š” ์˜๋ฏธ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์ง€ ์•Š์•„ HTML์ž‘์„ฑ ์‹œ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง„๋‹ค.
  • ๋”ฐ๋ผ์„œ ๊ฐ™์€ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ , ์˜๋ฏธ๋ฅผ ๋ถ€์—ฌํ•œ semantic tag๋ฅผ ์ด์šฉํ•œ๋‹ค.

ex)

 <header></header> <!--(๋จธ๋ฆฟ๋ง) -->
<main></main>
<footer></footer> <!--(๊ผฌ๋ฆฟ๋ง) -->
<address></address>

๋ชจ๋‘ div๋กœ ๋ฐ”๊ฟ”์ค˜๋„ ๊ฒฐ๊ณผ๋Š” ๋‚˜์˜จ๋‹ค. ํ•˜์ง€๋งŒ ๋ณด๊ณ  ์–ด๋ ค์›€์ด ์ƒ๊ธธ ์ˆ˜ ์žˆ๋‹ค. ๋˜ ๋‹ค๋ฅธ tag๋“ค์€ MDN์„ ํ†ตํ•ด ์•Œ์•„๋ณด์ž. ๊ฐ€๋…์„ฑ์„ ์œ„ํ•ด semantic tag๋ฅผ ์ด์šฉํ•˜์ž.

<body>
    <header>
      <h1>hyun soo</h1>
    </header>
    <main>
      <address>123123</address>
    </main>
    <footer></footer>
  </body>



Recap(๋ณต์Šต)

  • html์€ ๋ผˆ๋Œ€, CSS๋Š” ๊ทผ์œก, JS๋Š” ๋‡Œ๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค.
  • ํƒœ๊ทธ๋ฅผ ์—ด๋ฉด ๋‹ค์‹œ ๋‹ซ์•„์ค˜์•ผ ํ•œ๋‹ค.
  • attribute๋ฅผ ์ด์šฉํ•ด์„œ ํƒœ๊ทธ๋ฅผ ๊ฐ•๋ ฅํ•˜๊ฒŒ ๋งŒ๋“ค์–ด์ค€๋‹ค. ํ•ญ์ƒ ํฐ๋”ฐ์Œํ‘œ(โ€œโ€)๋ฅผ ์ด์šฉํ•œ๋‹ค.
  • ํƒœ๊ทธ๋งˆ๋‹ค attribute๊ฐ€ ๋‹ค๋ฅผ ์ˆ˜๋„ ๊ฐ™์„ ์ˆ˜๋„ ์žˆ๋‹ค.
  • (ex : id (๋ชจ๋“  ํƒœ๊ทธ), type (ํŠน์ • ํƒœ๊ทธ), src (ํŠน์ • ํƒœ๊ทธ)
  • header, main , footer, navigation, sidebar ๋Š” container์˜ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  div๋กœ ๋Œ€์ฒด ๊ฐ€๋Šฅํ•˜๋‹ค. ์˜๋ฏธ ํŒŒ์•…์„ ์œ„ํ•ด semantic์œผ๋กœ ์“ด๋‹ค.
  • Do not memorize !

ํƒœ๊ทธ: , ,

์นดํ…Œ๊ณ ๋ฆฌ:

์—…๋ฐ์ดํŠธ: