Client/HTML
[HTML] Table(ํ ์ด๋ธ) ํ๊ทธ ์ฌ์ฉ๋ฒ๊ณผ ์์
meeeeejin
2020. 6. 8. 17:29
HTML Table ํ๊ทธ
HTML์ <table> ํ๊ทธ๋ ํ๋ฅผ ๋ง๋ค์ด ์ฃผ๋ ํ๊ทธ์ ๋๋ค.
<table> ํ๊ทธ์ ๊ด๋ จ๋ ๊ธฐ๋ณธ์ ์ธ ํ๊ทธ๋ค์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
- <table>
// ํ ์ด๋ธ์ ๋ง๋๋ ํ๊ทธ - <th>
// ํ ์ด๋ธ์ ํค๋๋ฅผ ๋ง๋๋ ํ๊ทธ; ๊ฐ์ด๋ฐ ์ ๋ ฌ์ ๊ตต์ ๊ธ์จ๊ฐ default ๊ฐ์ - <tr>
// ํ ์ด๋ธ์ ํ์ ๋ง๋๋ ํ๊ทธ -
<td>
// ํ ์ด๋ธ์ ์ด์ ๋ง๋๋ ํ๊ทธ// <tr> ์์ ํฌํจ๋์ด ๊ฐ๊ฐ์ table data๋ฅผ ๋ด๊ณ ์์
์์ 1: ๊ฐ๋จํ ํ ์ด๋ธ ๋ง๋ค๊ธฐ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<table border="1">
<tr>
<th>header1</th>
<th>header2</th>
</tr>
<tr>
<td>row1 - data1</td>
<td>row1 - data2</td>
</tr>
<tr>
<td>row2 - data1</td>
<td>row2 - data2</td>
</tr>
</table>
|
cs |
Table ํ๊ทธ ๊ด๋ จ ์์ฑ๋ค
-
border
// ํ ์ด๋ธ์ ํ ๋๋ฆฌ ์ค์ -
width / height
// ํ ์ด๋ธ์ ๊ฐ๋ก / ์ธ๋ก ํฌ๊ธฐ ์ค์ -
align
// ํ ์ด๋ธ ์์ ๋ด์ฉ ์ ๋ ฌ -
bgcolor
// ๋ฐฐ๊ฒฝ ์ ์ค์ -
colspan
// ์ข์ฐ๋ก ์ด ํ์ฅ -
rowspan
// ์ํ๋ก ํ ํ์ฅ; ๋ฐ์ ์์์์ ์ฒ๋ผ rowspan๋ <td> ํ๊ทธ์์ ์ฌ์ฉํด์ผ ํจ
์์ 2: ์์ฑ ๊ฐ ์ฌ์ฉํด๋ณด๊ธฐ
1
2
3
4
5
6
7
8
9
10
11
12
|
<table border="1">
<tr>
<td colspan="2" align="center">colspan & align</td>
</tr>
<tr>
<td rowspan="2">rowspan</td>
<td bgcolor="yellow">bgcolor</td>
</tr>
<tr>
<td bgcolor="lightblue">bgcolor</td>
</tr>
</table>
|
cs |

728x90