본문 바로가기
괴발개발/web

표 관련 태그

by 맛길만걷자 2024. 5. 30.
728x90
반응형
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <!-- 반응형 웹을 만들기 위한 설정(기계의 넓이를 인식)-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>04_표 관련 태그</title>

    <!-- HTML 문서의 스타일(크기,생상,모양 등)을 지정하는 태그 == css-->



    <style>
        .tb3{
            border: 2px solid black;

        }

        .tb3 th,td{
            border:1px solid black;
        }

        .tb3 thead{
            background-color: yellowgreen;
        }
       
        .tb3 tbody{
            background-color : yellow;
        }
        .tb3 tfoot{
            background-color: orange;
            color:white;
        }


    </style>

</head>

<body>
    <h1>04_표 관련 태그</h1>

    <pre>
        <h3>table 태그</h3>
        - 웹 문서에서 자료 정리를 위해 사용하는 태그
        - 행과 열로 이루어졌으며, 행과 열이 교차하는 지점을 셀(cell)이라고 함
   
        - table 태그는 테이블을 나타내는 행과 열이 작성될 수 있는 영역을 지정함

    </pre>

    <pre>
        <h3>tr 태그</h3>
        - Table Row의 약자로 한 행을 나타내는 태그
    </pre>
    <pre>
            <h3>td 태그</h3>
            - Table Data의 약자로 한 행의 한 컬럼(==셀)을 나타내는 태그

    </pre>

    <pre>
            <h3>th 태그</h3>
            -Table Header의 약자로 컬럼명을 표시하는 용도의 태그
            - 기본성질은 td태그와 같으나
              추가적으로 굵은 글씨, 가운데 정렬이 이루어짐
    </pre>

    <pre>
            <h3>caption 태그</h3>
            - 테이블의 제목이나 설명 내용을 추가하는 태그
    </pre>

    <!-- boarder="1" : table, td태그에 1px짜리 검은색 테두리 추가-->
    <table border="1">

        <caption>
            <strong style="color:deeppink">웹 브라우저의 종류</strong>
        </caption>

        <!-- 1행 -->
        <tr>
            <th>브라우저 </th><!-- 1행 1열-->
            <th>제조사</th><!-- 1행 2열-->
            <th>홈페이지</th><!-- 1행 3열-->
        </tr>
        <tr></tr>
        <td>크롬</td> <!-- 2행 1열-->
        <td>Google</td> <!-- 2행 2열-->
        <td>https://www.google.com</td><!--2행 3열-->
        </tr>
        <tr><!--3행-->
            <td>엣지</td>
            <td>MS</td>
            <td>https://www.microsoft.com</td>
        </tr>

        <tr><!--4행-->
            <td>파이어폭스</td>
            <td>Mozilla</td>
            <td>http://www.mozilla.com</td>
        </tr>
    </table>

    <h2>행 병합(rowspan), 열 병합(colspan)</h2>

    <pre>
        td 또는 th 태그에 작성하는 속성
        rowspan : 행(상하)병합
        colspan : 열(좌우)병합
    </pre>
    <!-- width(폭/너비), height(높이)-->
    <table border="1">
        <tr>
            <th width="70px">이름</th>
            <td width="210px"></td>
            <th width="140px" height="140px" rowspan="2">사진</th>

        </tr>
        <tr>
            <th>연락처</th>
            <td></td>

        </tr>
        <tr>
            <th height="35px">주소</th>
            <td colspan="2"></td>

        </tr>
        <tr>
            <th height="140px">자기소개</th>
            <td colspan="2"></td>
        </tr>

    </table>

    <h2>테이블 구조 설정 태그</h2>
    <pre>
        thead : 테이블 상단 구분 영역(컬럼명)
        tbody : 테이블의 중단 부분 영역(실제 갑, 내용)
        tfoot : 테이블의 하단 부분 영역(합계)
    </pre>

    <table class="tb3">
        <thead>
            <tr>
                <th>이름</th>
                <th>나이</th>
                <th>주소</th>
            </tr>
        </thead>

        <tbody>
            <tr>
                <td>홍길동</td>
                <td>20</td>
                <td>서울시 구로구</td>
            </tr>
            <tr>
                <td>김지석</td>
                <td>30</td>
                <td>서울시 금천구</td>

            </tr>

            <tr>
                <td>박영희</td>
                <td>25</td>
                <td>경기도 부천시</td>

            </tr>
       
        </tbody>
        <tfoot>
            <tr>
                <th colspan="2">총인원</th>
                <th > 3명</th>

            </tr>

        </tfoot>
    </table>


</body>

</html>

 

728x90
반응형

'괴발개발 > web' 카테고리의 다른 글

하이퍼 링크 태그  (0) 2024.05.31
CSS 개요, 선택자  (0) 2024.05.30
이미지 관련 태그  (0) 2024.05.30
영역 관련 태그  (0) 2024.05.30
목록관련태그  (0) 2024.05.29