표 너비와 높이

표 너비와 높이

 

표의 너비와 높이는 width및 height속성 에 의해 정의됩니다 .

 

아래 예제는 표의 너비를 100 %로 설정하고 <th> 요소의 높이를 50px로 설정합니다.

 

 

table {

    width: 100%;

}

 

th {

    height: 50px;

}

 

 

 

<!DOCTYPE html>

<html>

<head>

<style>

table, td, th {

    border: 1px solid black;

}

 

table {

    border-collapse: collapse;

    width: 100%;

}

 

th {

    height: 50px;

}

</style>

</head>

<body>

 

<h2>The width and height Properties</h2>

<p>Set the width of the table, and the height of the table header row:</p>

 

<table>

  <tr>

    <th>Firstname</th>

    <th>Lastname</th>

    <th>Savings</th>

  </tr>

  <tr>

    <td>Peter</td>

    <td>Griffin</td>

    <td>$100</td>

  </tr>

  <tr>

    <td>Lois</td>

    <td>Griffin</td>

    <td>$150</td>

  </tr>

  <tr>

    <td>Joe</td>

    <td>Swanson</td>

    <td>$300</td>

  </tr>

  <tr>

    <td>Cleveland</td>

    <td>Brown</td>

    <td>$250</td>

</tr>

</table>

 

</body>

</html>

 

d866788e1a0adf57d7c33e15dc0ff6b6_1488289369_7974.png
 

|
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리셔팁

퍼블리싱과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
CSS 8년 전 조회 2,390
CSS 8년 전 조회 2,467
CSS 8년 전 조회 3,029
CSS 8년 전 조회 2,682
CSS 8년 전 조회 2,551
CSS 8년 전 조회 1,994
CSS 8년 전 조회 2,033
CSS 8년 전 조회 2,276
CSS 8년 전 조회 1,701
CSS 8년 전 조회 2,364
CSS 8년 전 조회 1,903
CSS 8년 전 조회 2,340
CSS 8년 전 조회 2,366
CSS 8년 전 조회 2,382
CSS 8년 전 조회 2,191
CSS 8년 전 조회 1,935
CSS 8년 전 조회 2,393
CSS 8년 전 조회 1,747
CSS 8년 전 조회 1,831
CSS 8년 전 조회 1,923
CSS 8년 전 조회 2,558
CSS 8년 전 조회 2,627
CSS 8년 전 조회 1,993
CSS 8년 전 조회 2,475
CSS 8년 전 조회 2,004
CSS 8년 전 조회 2,063
CSS 9년 전 조회 1,944
CSS 9년 전 조회 1,685
CSS 9년 전 조회 1,733
CSS 9년 전 조회 3,256