본문 바로가기

HTML/HTML 기초

[HTML] table에서 thead, tbody, tfoot 사용해 보기 - 1

<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>강수량</title>
</head>

<body>
    <table border="1" style="text-align: center;">
        <thead>
            <tr>
                <th rowspan="2">지역</th>
                <th colspan="2">평년값(1981~2010)</th>
                <th colspan="2">최근5년(2011~2015)평균</th>
            </tr>
            <tr>
                <th>강수일수(일)</th>
                <th>강수량(mm)</th>
                <th>강수일수(일)</th>
                <th>강수량(mm)</th>
            </tr>
        </thead>
        <tbody>

            <tr>
                <th>중부</th>
                <th>172</th>
                <th>366.4</th>
                <th>189(+9.9%)</th>
                <th>391(+6.9%)</th>
            </tr>
            <tr>
                <th>남부</th>
                <th>171</th>
                <th>348.6</th>
                <th>170(-0.6%)</th>
                <th>293.5(-15.8%)</th>
            </tr>
            <tr>
                <th>제주</th>
                <th>183</th>
                <th>398.6</th>
                <th>174(-4.9%)</th>
                <th>386.2(+3.1%)</th>
            </tr>
        </tbody>
        <tfoot style="background-color: lightgray;">
            <tr>
                <th>전국</th>
                <th>171</th>
                <th>356.1</th>
                <th>178(+4.1%)</th>
                <th>355(-0.3%)</th>
            </tr>
        </tfoot>
    </table>
</body>

</html>

728x90
반응형