HTML #3 - Table Tag

ennakoidaΒ·2023λ…„ 5μ›” 24일
0

HTML

λͺ©λ‘ 보기
3/8

πŸ“ Table Tag

ν‘œλ₯Ό λ§Œλ“œλŠ” νƒœκ·Έμ—λŠ” table, tr, td, thκ°€ μžˆλ‹€.

<table> : 기본적으둜 ν‘œλ₯Ό μƒμ„±ν•΄μ£ΌλŠ” νƒœκ·Έ
<tr> : ν‘œμ˜ 행을 λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ
<td> : ν‘œμ˜ 열을 λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ
<th> : ν‘œμ˜ 제λͺ© 셀을 λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ (글씨 진해짐)

기본적인 ν‘œ λ§Œλ“€κΈ°

<table border="1"> <!-- border 속성 : ν…Œλ‘λ¦¬ λ‘κ»˜ (default = 0)-->
    <caption>ν…Œμ΄λΈ”μ˜ 타이틀</caption>
    <tr>
        <!-- 제λͺ©μ„ λ‚˜νƒ€λ‚΄λŠ” thλŠ” td 속성을 λŒ€μ²΄ν•œλ‹€ -->
        <th>제λͺ© 1</th>
        <th>제λͺ© 2</th>
    </tr>
    <tr>
        <td>μ„Ήμ…˜ 1-1</td>
        <td>μ„Ήμ…˜ 1-2</td>
    </tr>
    <tr>
        <td>μ„Ήμ…˜ 2-1</td>
        <td>μ„Ήμ…˜ 2-2</td>
    </tr>
</table>
<!-- figure : ν…Œμ΄λΈ” ν•˜λ‹¨μ— μ„€λͺ…을 λ‹€λŠ” νƒœκ·Έ -->
<figure>figure</figure>

ν…Œμ΄λΈ”μž„μ„ λͺ…μ‹œν•΄μ£ΌλŠ” <table>νƒœκ·Έλ₯Ό μž‘μ„±ν•˜κ³ , κ·Έ μ•ˆμ— <tr>둜 행을, κ·Έ μ•ˆμ— <td>둜 열을 λ‚˜νƒ€λ‚Ό 수 μžˆλ‹€.
단, ν…Œμ΄λΈ”μ˜ 제λͺ©μ„ λ‚˜νƒ€λ‚Ό λ•Œμ—λŠ” <td>λŒ€μ‹  <th>λ₯Ό μ‚¬μš©ν•΄ 더 κ°•μ‘°λœ ν‘œν˜„μ„ ν•  수 μžˆλ‹€.

ν‘œμ˜ ν–‰ / μ—΄ ν•©μΉ˜κΈ°

<table border="1">
    <caption>ν–‰ ν•©μΉ˜κΈ°</caption>
    <tr>
        <!-- rowspan : ν–‰ ν•©μΉ˜κΈ° -->
        <td rowspan="2">μ„Ήμ…˜ 1-1</td>
        <td>μ„Ήμ…˜ 1-2</td>
    </tr>
    <tr>
        <!-- <td>μ„Ήμ…˜ 2-1</td> -->
        <td>μ„Ήμ…˜ 2-2</td>
    </tr>
</table>

<table border="1">
    <caption>μ—΄ ν•©μΉ˜κΈ°</caption>
    <tr>                
        <!-- colspan : μ—΄ ν•©μΉ˜κΈ° -->
        <!-- width : λ„ˆλΉ„ / height : 높이 -->
        <td colspan="2" width="100" height="50" align="center">μ„Ήμ…˜ 1-1</td>
        <!-- <td>μ„Ήμ…˜ 1-2</td> -->
    </tr>
    <tr>
        <td>μ„Ήμ…˜ 2-1</td>
        <td>μ„Ήμ…˜ 2-2</td>
    </tr>
</table>

0개의 λŒ“κΈ€