table-layout: fixed : table요소의 cell의 너비를 동일하게 고정



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
<!DOCTYPE html>
<html>
<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>
    <style>
    table {
        /* table-layout: fixed : table요소의 cell의 너비를 동일하게 고정 */
        table-layout: fixed;
        
        width: 100%;
        border: 1px solid #000;
    }
    td {
        height: 50px;
        border: 1px solid #000;
    }
    </style>
</head>
 
<body>
    <table>
        <tr>
            <td>4월 17일</td>
            <td>우리은행 공과금 이체</td>
            <td>10,000원</td>
        </tr>
        <tr>
            <td>4월 17일</td>
            <td>노트</td>
            <td>3,000원</td>
        </tr>
    </table>
</body>
</html>
cs



결과

컬럼 3개의 너비가 텍스트의 길이에 상관없이 동일하다

+ Recent posts