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๋ ์ธ๋ถ ๋งํฌ๊ฐ ์๋ ๋ก์ปฌ์ ํตํด์๋ ๊ฐ์ ธ์ฌ ์ ์๋ค. (๊ฐ์ ํด๋์ ์์ด์ผ ํ๋ค.)
html rule / head, body role
- html ๋ฌธ์๋ ๋ค์๊ณผ ๊ฐ์ ๊ท์น์ ๊ฐ์ง๋ค.
- ๊ฐ์ฅ ๋จธ๋ฆฌ๋ง์ DOCTYPE html์ ์ ์ด์ค์ผ๋ก์จ html ๋ฌธ์๋ผ๋ ๊ฒ์ ๋ช ์ํด์ค๋ค.
- html ๋ด๋ถ์๋ head์ body ๋๊ฐ์ง๋ก ๋๋๋ค. head๋ ์น์ฌ์ดํธ์ ํ๊ฒฝ / ๋ณด์ด์ง ์๋ ๊ณณ์ ๋ง๋ค์ด์ค๋ค. body๋ ์น์ฌ์ดํธ์์ ๋ณด์ฌ์ง๋ ๊ณณ์ ๋ง๋ ๋ค.
- 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์ ๊ฒ์ํ์ ๋ ๋ถ๊ฐ์ค๋ช
์ผ๋ก ๋์ค๊ฒ ๋๋ค.
<!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 !