colspan : 가로셀 합치기

rowspan : 세로셀 합치기



html)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="utf-8">
    <meta name="viewport" 
          content="width=device-width, height=device-height, 
                     minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0">
    <title>Insert title here</title>
</head>
 
<body>
<figure>
    <figcaption>
        <strong>figcaption</strong>
        <p>테이블의 설명을 작성할 수 있습니다.</p>
    </figcaption>
    <table border="1">    
        <colgroup>
            <col width="20%">
            <col width="40%">
            <col width="*">
        </colgroup>    
        <thead>
            <tr>
                <th scope="col"></th>
                <!-- 
                    colspan : 가로셀 합치기
                    rowspan : 세로셀 합치기
                 -->
                <th scope="col" colspan="2">header1</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <th scope="row">row 1</th>
                <td rowspan="2">data 1-1</td>
                <td>data 1-2</td>
            </tr>
            <tr>
                <th scope="row">row 2</th>
                <td>data 2-2</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <th scope="row" id="re">결과</th>
                <td>result 1</td>
                <td>result 2</td>
            </tr>
        </tfoot>
    </table>
</figure>
</body>
</html>
cs



결과)




+ Recent posts