HTML & CSS π/HTML μ°μ΅
2μΌμ°¨ table νκ·Έ
Maryland_09
2020. 10. 24. 16:22
ν νμμ λ μ΄μμμ λ§λλ νκ·Έ
<table> </table> μ¬μ΄μ <tr> <td>νκ·Έλ₯Ό λ£λλ€.
- <table> : νλ₯Ό λνλ΄λ νκ·Έ
- <tr> : νμ λνλ΄λ νκ·Έ (table row)
- <th> : μ λͺ© μ μ λνλ΄λ νκ·Έ (table header)
- <td> : μ μ λνλ΄λ νκ·Έ (table data)
- <caption>: νμ μ λͺ©μ λνλ΄λ νκ·Έ
- <thead>: μ λͺ© νμ κ·Έλ£Ήννλ νκ·Έ
- <tfoot>: λ°λ₯ νμ κ·Έλ£Ήννλ νκ·Έ
- <tbody>: λ³Έλ¬Έ νμ κ·Έλ£Ήννλ νκ·Έ
<tr>
<td>Korean</td>
<td>Math</td>
<td>Science</td>
</tr>
<tr> νκ·Έ μμ <td>κ° λμ΄λ μλ‘ κ°λ‘ μ μ΄ μ¬λ¬κ°κ° μκΈ΄λ€.
μΈλ‘λ‘ νμ λλ¦¬κ³ μΆμΌλ©΄ <tr>νκ·Έλ₯Ό λλ €μ£Όλ©΄ λλ€.
Border: ν μ΄λΈμ λκ» μ€μ
ν° λ°μ΄ν μμ μ«μλ₯Ό λ£μ΄ λκ» κ°μ λ£μ΄μ€λ€.
<table border="2"> border - ν μ΄λΈμ ν λ리 λκ»
Colspan : μ΄ ν©μΉκΈ° (κ°λ‘λ‘)
λ°μ΄ν μμ μ«μλ₯Ό λ£μ΄ λͺ κ°μ μ΄μ ν©ν κ²μΈμ§ κ°μ λ£μ΄μ€λ€.
<td colspan="2">
Rowspan: ν ν©μΉκΈ° (μΈλ‘λ‘)
colspanκ³Ό λ§μ°¬κ°μ§λ‘ λͺ κ°λ₯Ό ν©ν κ²μΈμ§ κ°μ λ£μ΄μ€λ€.
<td rowspan="4">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="3">
<tr>
<td rowspan="4"> Mid-term test scores </td>
</tr>
<tr>
<td>Korean</td>
<td>Math</td>
<td>Science</td>
</tr>
<tr>
<td>100</td>
<td>95</td>
<td>98</td>
</tr>
<tr>
<td colspan="2"> Average </td>
<td>90</td>
</tr>
</table>
<table>
<table border="1">
<tr>
<td>1ν 1μ΄</td>
<td>1ν 2μ΄</td>
<td>1ν 3μ΄</td>
<td>1ν 4μ΄</td>
</tr>
<tr>
<td>2ν 1μ΄</td>
<td>2ν 2μ΄</td>
<td>2ν 3μ΄</td>
<td>2ν 4μ΄</td>
</tr>
<tr>
<td colspan="2">3ν 1μ΄</td>
<td>3ν 3μ΄</td>
<td>3ν 4μ΄</td>
</tr>
</table>
</body>
</html>
κ²°κ³Όλ¬Ό