Index
Β
<table>
<table> νκ·Έλ ν
μ΄λΈμ μμ±ν λ μ¬μ©ν©λλ€. νλμ ν
μ΄λΈμ μ μν©λλ€.
Β
<tr>, <th>, <td>
<tr> νκ·Έλ ν
μ΄λΈμ νμ λλ λ μ¬μ©ν©λλ€. <td> νκ·Έλ <tr> νκ·Έλ‘ λλ νμμ μ
μ λΆλ¦¬ν λ μ¬μ©ν©λλ€. HTML μμμ λͺ¨λ μ’
λ₯(ν
μ€νΈ, μ΄λ―Έμ§, λͺ©λ‘, ν
μ΄λΈ λ±)λ₯Ό ν¬ν¨ν μ μμ΅λλ€. <th> νκ·Έλ ν, μ΄μ 머리λ§μ λνλ΄λ λ° μ¬μ©ν©λλ€. κΈμ¨λ₯Ό κ΅΅κ³ κ°μ΄λ° μ λ ¬νμ¬ λ³΄μ¬μ€λλ€.
Β
<table> <tr> <th>ꡬλΆ</th> <th>μ΄λ¦</th> <th>ν맀λ</th> </tr> <tr> <td>1</td> <td>ν΄λ¦¬ν¬ν°</td> <td>100</td> </tr> </table>
Β
colspan, rowspan
<td> λλ <th> νκ·Έ μμμ Colspan μμ±μ μ¬μ©νλ©΄ κ°λ‘λ‘ μ
λ€μ λ³ν©ν μ μμ΅λλ€. λν rowspan μμ±μ μ¬μ©νλ©΄ μΈλ‘λ‘ μ
λ€μ λ³ν©ν μ μμ΅λλ€. μ΄λ λ³ν©νκ³ μΆμ μ
μ κ°μλ₯Ό μ§μ ν΄ μ€λλ€.
<tr> <td colspan="2">μ΄ ν맀λ</td> <td>600</td> </tr>
Β
Β
<thead>, <tbody>, <tfoot>
<thead>, <tbody>, <tfoot> νκ·Έλ κ°κ° 머리κΈ, λ³Έλ¬Έ, λ°λ₯ κΈμ μλ―Έ ν©λλ€. ν
μ΄λΈμ λ΄μ©μ΄ λ§μ λ <thead>μ <tfoot>λ 머리κΈκ³Ό λ°λ₯ κΈμ κ³ μ μμΌ λλ μμλ‘ μ¬μ©ν©λλ€. μ΄ μμλ€μ ν
μ΄λΈμ λ μ΄μμμ μν₯μ λ―ΈμΉμ§ μμ΅λλ€. νμ§λ§ CSSλ₯Ό μ¬μ©νμ¬ λμμΈμ μ€νμΌμ μ§μ ν μ μμ΅λλ€.
Β
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Page Title</title> <style> table, tr, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <!-- 1. thead, tbody, tfoot, captionμ΄λ colgroupμ νμ§ μμ΅λλ€ 2. ꡬλλ₯Ό μ‘λ μ©λλ‘ μ¬μ©νμ§ μμ΅λλ€. --> <table> <thead> <tr> <th>ꡬλΆ</th> <th>μ΄λ¦</th> <th>ν맀λ</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>ν΄λ¦¬ν¬ν°</td> <td>100</td> </tr> <tr> <td>2</td> <td>νκ±°κ²μ</td> <td>200</td> </tr> <tr> <td>3</td> <td>λ°μ§μμ μ</td> <td>300</td> </tr> </tbody> <tfoot> <tr> <td colspan="2">μ΄ ν맀λ</td> <td>600</td> </tr> </tfoot> </table> </body> </html>
Β
Β
<caption>, <colgroup>
- colgroupμμ colμ spanμ μ¬μ©νμ¬ μ¬λ¬ μ μ μ§μ νλ κ²λ κ°λ₯ν©λλ€.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Page Title</title> <style> table { width: 100%; } table, tr, th, td { border: 1px solid black; border-collapse: collapse; } .κ΅¬λΆ { width: 20%; } .μ΄λ¦ { width: 50%; } .ν맀λ { width: 20%; } </style> </head> <body> <!-- 1. thead, tbody, tfoot, captionμ΄λ colgroupμ νμ§ μμ΅λλ€ 2. ꡬλλ₯Ό μ‘λ μ©λλ‘ μ¬μ©νμ§ μμ΅λλ€. --> <table> <caption> μ΄ tableμ μκ΅μμ μ΅μ΄λ‘ μμλμ΄ μΌλ μ νλ°ν΄ λλ©΄μ... </caption> <colgroup> <col class="ꡬλΆ" /> <col class="μ΄λ¦" /> <col class="ν맀λ" /> </colgroup> <thead> <tr> <th>ꡬλΆ</th> <th>μ΄λ¦</th> <th>ν맀λ</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>ν΄λ¦¬ν¬ν°</td> <td>100</td> </tr> <tr> <td>2</td> <td>νκ±°κ²μ</td> <td>200</td> </tr> <tr> <td>3</td> <td>λ°μ§μμ μ</td> <td>300</td> </tr> </tbody> <tfoot> <tr> <td colspan="2">μ΄ ν맀λ</td> <td>600</td> </tr> </tfoot> </table> </body> </html>
Β
Β
scope
<th>
μμμ scope
μμ±μ μ¬μ©ν΄ 머리λ§μ΄ μ΄μ λν κ²μΈμ§ μλλ©΄ νμ λν κ²μΈμ§ λνλΌ μ μμ΅λλ€. - row : νμ λν λ¨Έλ¦Ώλ§μ λλ€.
- col : μ΄μ λν λ¨Έλ¦Ώλ§μ λλ€.
Β
scope
μμ±μ μ΄μ©ν μν, μμ§ ν
μ΄λΈμ ꡬν<!-- μ§μ ꡬννμ¬ κ²°κ³Όλ₯Ό νμΈν΄ 보μΈμ --> <table> <caption>μμΌλ³ κΈμ λ§μ‘±λ</caption> <tbody> <tr> <th></th> <th scope="col">μμμΌ</th> <th scope="col">νμμΌ</th> <th scope="col">μμμΌ</th> <th scope="col">λͺ©μμΌ</th> <th scope="col">κΈμμΌ</th> <th scope="col">ν μμΌ</th> </tr> <tr> <th scope="row">λ©λ΄</th> <td>λκΉμ€</td> <td>μ§μ₯λ©΄</td> <td>λ³Άμλ°₯</td> <td>ν΄λ¬ΌλΌλ©΄</td> <td>μμΉκ΅μ</td> <td>λ‘λ³Άμ΄</td> </tr> </tbody> <tfoot> <tr> <th scope="row">λ§μ‘±λ</th> <td>3/5</td> <td>4/5</td> <td>1/5</td> <td>5/5</td> <td>2/5</td> <td>3/5</td> </tr> </tfoot> </table>
Β
- scope, colgroupμ λν λ³΄κ° μ€λͺ