Tables
<table>
<td> table data cell or table data
<tr> table row
<th> table head
<thead>
<tbody>
<tfoot>
์ 3๊ฐ์ง๋ ์ฝ๋ ์ ์ ๊ทผ์ฑ, ๊ฐ๋
์ฑ
rowspan
colspan
ํค๋๋ฅผ 2ํ์ผ๋ก ๋ง๋ค ๋ ์ฌ์ฉํ ์ ์์
Table ์ฌ์ฉ ์์
<body>
<table>
<thead>
<tr>
<th rowspan="2">Subscription</th>
<th colspan="2">Price</th>
<th rowspan="2">Support</th>
</tr>
<tr>
<th>member</th>
<th>non member</th>
</tr>
</thead>
<tbody>
<tr>
<td>Free</td>
<td>Free</td>
<td>Free</td>
<td>N/A</td>
</tr>
<tr>
<td>Personal</td>
<td>$4.99</td>
<td>$9.99</td>
<td>Weekdays</td>
</tr>
<tr>
<td>Business</td>
<td>$29.99</td>
<td>$49.99</td>
<td>24/7</td>
</tr>
</tbody>
</table>
</body>
์๋ ๊ฒฐ๊ณผ๋ฌผ
๋ถ๊ฐ์ค๋ช
<th>์์ price๋ฅผ ๋๊ฐ๋ก ๋ถ๋ฅํ๊ณ ์ถ์ด์ rowspan์ ์ฌ์ฉํด ๋๋จธ์ง ๋ ํญ๋ชฉ์ธ sub์ sup์
2ํ ํฌ๊ธฐ๋งํผ ์ฐจ์งํ๊ฒ ๋ง๋ ๋ค์ colspan์ ์ฌ์ฉํด price์๋ 2๊ฐ ์ด ๋งํผ์ ํฌ๊ธฐ๊ฐ ๋ค์ด๊ฐ
์ ์๊ฒ๋ ํ ๊ฒ์ด๋ค.
<input> ์ผ๋ฐ์ ์ธ ์
๋ ฅ ํ์ (๋ซ๋ ํ๊ทธ๊ฐ ์์)
<input ~~~~~~~>
Type - text, password, color, time, etc..
Placeholder = ์
๋ ฅ๋์ ์์ ํ
์คํธ๋ฅผ ์ง์ ํ๋ ์์ฑ
<form action="/tacos">
<input type="text" placeholder="User Name">
<input type="password" placeholder="PassWord">
<input type="color">
<input type="time">
</form>
<label>
<p>
<label for="username">Enter a Username:</label>
<input id="username" type="text" placeholder="User Name">
</p>
<p>
<label for="password">Enter a Password:</label>
<input id="password" type="password" placeholder="PassWord">
</p>
<p>
<label for="color">choise a color</label>
<input id="color" type="color">
</p>
<label> ์์ ์๋ for = "A"์ <input>์์ ์๋ id = "A"๋ฅผ A์ฒ๋ผ
๊ฐ์ text๋ก ์จ์ฃผ๋ฉด ์ฐ๊ฒฐ ์์ผ์ค ์ ์์
<label>
Enter a Number:
<input type="Number" placeholder="enter a number">
</label>
์ด๋ ๊ฒ ์ฌ์ฉํด๋ ์ฐ๊ฒฐ์ํฌ ์ ์๋ค.
<button> js์ ํจ๊ป ๋ง์ด ์ฐ์
ํผ์์ ์๋ ๋ฒํผ๊ณผ ํผ๋ฐ์ ์๋ ๋ฒํผ์ ์๋์์์ ์ฐจ์ด๊ฐ ์๋ค.
ํผ์์์๋ผ๋ type์ button์ผ๋ก ์ง์ ํ๋ค๋ฉด ์ ์ถ์ ๊ธฐ๋ฅ์ด ์๋๋ผ
๋จ์ํ ๋ฒํผ์ผ๋ก์ ๊ธฐ๋ฅํ ์ ์๋ค.
+) button์ label์ ์ฐ๊ฒฐํ์ง ์๋๋ค ์ถฉ๋์ด ์๊ธธ ์ ์๋ค
name ์์ฑ
input์์์ ์ฐ์ด๋ฉฐ ๋ฐ์ดํฐ๋ฅผ ์ ์กํ ๋ ์ด์ฉํ ๋ถ๋ถ์
ํด๋น์ด๋ฆ์ผ๋ก ๋ ์ด๋ธ๋ง ๋์ด์์ (์ค์!)
์๋ฒ๋ก ๋ฐ์ดํฐ๋ฅผ ์ ์กํ ๋ ์ฌ์ฉ
<label for="username">Enter a Username:</label>
<input id="username" type="text" placeholder="User Name" name="username">
<form>ํ์ฉ
<form action="https://www.youtube.com/results">
<input type="text" name="search_query">
<button>Search Youtube</button>
</form>
๋ฒํผ์ ๋ง๋ค์ด์ action์ ์๋ ์ฃผ์์ ๋ฐ๋ผ ์ ํ๋ธ ๊ฒ์์ ํ๊ฒ ๋จ
input type - checkbox
<form action="/birds">
<input type="checkbox" name="agree_tos" id="agree">
<label for="agree">i agree to everything</label>
<button>Submit</button>
</form>
input type - radio
<label for="xs">xs:</label>
<input type="radio" name="size" id="xs" value="xsmall">
<label for="s">s:</label>
<input type="radio" name="size" id="s" value="small">
<label for="m">m:</label>
<input type="radio" name="size" id="m" value="medium">
value ๊ฐ์ด ์๋ฒ์ ๋๊ฒจ์ฃผ๋ ๊ฐ์ด ๋๋ ๊ฒ
Checkbox and Radio Difference?
์ ์๋ ์ฒดํฌ๋ฐ์ค๊ฐ 2๊ฐ๋ผ๊ณ ๊ฐ์ ํ์ ๋ 2๊ฐ ๋ชจ๋ ์ ํํ๊ฑฐ๋ ํ์ง ์๊ฑฐ๋ ์๊ด์์
ํ์๋ ์ฒดํฌ๋ฐ์ค๊ฐ 3๊ฐ๋ผ๊ณ ๊ฐ์ ํ์ ๋ 3๊ฐ ์ค ๋จ ํ๊ฐ๋ง ์ ํ ๋์ด์ผ ํจ
name๊ฐ์ด size๋ก ํต์ผ๋์ด ์๋๋ฐ ์ด๋ ๊ฒ ํด์ผ ๊ฐ๊ฐ์ ๊ฒ๋ค์ด ํ๋๋ก ์ฐ๊ฒฐ์ด ๋จ
<select> ๊ณผ ํ์ ๋ชฉ๋ก์ธ <option>
<label for="meal">please select an entree</label>
<select name="meal" id="meal">
<option value="">--please select--</option>
<option value="fish">Fish</option>
<option value="veg" selected>Veg</option>
<option value="steak">Steak</option>
</select>
์ฒซ๋ฒ์งธ ์ต์
์ฒ๋ผ value๋ฅผ ๋น์๋๊ณ text๋ง ๋ฃ์ ์๋ ์๋ค.
๋ํ selected์ฒ๋ผ ๋งจ์์ ๊ฐ์ด ์๋ ๋ค๋ฅธ ๊ฐ์ ์๋์ผ๋ก ์ ํ๋๋๋ก ํ ์ ์๋ค.
input type - range
<label for="range">amount of cheese</label>
<input type="range" id="range" min="1" max="99" step=4"name="cheese level">
min max ๊ฐ๊ณผ step์ ํ์นธ๋น ์ผ๋ง์ฉ ์ค๋ฅด๋ด๋ฆด์ง ์ ํ ์ ์๋ค.
<textarea>
<label for="request">any request</label>
<br>
<textarea name="request_server" id="request" cols="30" rows="10"
placeholder="something"></textarea>
์ฌ๋ฌ ์ฅ์ ์ด ์๋ค
๋ ์ด๋ธ ํ
์คํธ๋ ์๊ฐ์ ์ผ๋ก๋ง ์ปจํธ๋กค์ ์ฐ๊ฒฐ๋ ๊ฒ์ด ์๋๋ผ, ํ๋ก๊ทธ๋จ ์์์๋ ์ฐ๊ฒฐ๋๋ค
์ด ๋ง์ ๋ณด์กฐ ๊ธฐ์ ์ญ์ ์ด๋ค ์ปจํธ๋กค์ ์ค๋ช
์ด ์ ํํ ๋ฌด์์ธ์ง ์ ์ ์๋ค๋ ๊ฒ์ด๋ฏ๋ก,
์ฌ์ฉ์๊ฐ ์์ ์
๋ ฅ ์นธ์ ํฌ์ปค์ค๋ฅผ ํ ๊ฒฝ์ฐ, ์คํฌ๋ฆฐ ๋ฆฌ๋๊ฐ ๊ทธ ์นธ์ ๋ํ ์ฌ๋ฐ๋ฅธ ์ค๋ช
์
์ฝ์ด์ค ์ ์์ด์ ์ฌ์ฉ์๊ฐ ์ด๋ค ๋ฐ์ดํฐ๋ฅผ ์
๋ ฅํด์ผ ํ๋์ง ์ดํดํ๊ธฐ๊ฐ ์ฌ์์ง๋ค
๋ ์ด๋ธ์ ํด๋ฆญํ๊ฑฐ๋ ํฐ์นํ๋ ๊ฒฝ์ฐ, ๋ธ๋ผ์ฐ์ ๋ ๋ ์ด๋ธ์ด ์ฐ๊ฒฐ๋ ์์๋ก ํฌ์ปค์ค๋ฅผ ์ ๋ฌํ๋ค
+) <label>์ <input>๊ณผ ์ฐ๊ฒฐํ๋ ค๋ฉด ์ฐ์ <input>์ id ํน์ฑ์ ์ง์ ํด์ผ ํ๋ค
<label>์๋ for ํน์ฑ์ ๊ทธ id์ ๋์ผํ ๊ฐ์ ์ง์ ํ๋ค
๋๋, <input>์ <label>์ ์์ ๋ฐฐ์นํ๋ ๋ฐฉ๋ฒ๋ ์๋ค
์ด ๋๋ ์์์ ์ผ๋ก ์๋ก์ ๊ด๊ณ๋ฅผ ์์ฑํ๋ฏ๋ก id์ for ํน์ฑ์ ์ง์ ํ ํ์๋ ์๋ค
HTML5 ํผ ์ ํจ์ฑ ๊ฒ์ฌ
Html attribute - input - required
<label for="first">Enter First Name</label>
<input type="text" name="first" id="first" required>
<p>
<label for="username">Username</label>
<input type="text" name="username" id="username"
minlength="5" maxlength="20" required>
</p>
required = ์
๋ ฅ๊ฐ์ด ์์ผ๋ฉด ์ ์ถ์ด ์๋จ
minlength, maxlength = ์์ range์ min๊ณผ max์ ๊ตฌ๋ณ๋๊ฒ ์์ ๋ ๊ฒ
๋ง์ฐฌ๊ฐ์ง๋ก ์ถฉ์กฑํ์ง ๋ชปํ ์ ์ ์ถ์ด ์๋จ