๐Ÿ’›[๋ถ€์ŠคํŠธ์ฝ”์Šค_์›น UI ๊ฐœ๋ฐœ] 17. ํ‘œ

๐Ÿ‘พยท2021๋…„ 1์›” 30์ผ
0

HTML & CSS

๋ชฉ๋ก ๋ณด๊ธฐ
17/20

ํ‘œ ์†Œ๊ฐœ

Table์ด๋ž€?

HTML์—์„œ ํ…Œ์ด๋ธ”์€ ํ‘œ๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค.
ํ‘œ๋Š” ์–ด๋–ค ๋‚ด์šฉ์„ ์ผ์ •ํ•œ ํ˜•์‹๊ณผ ์ˆœ์„œ์— ๋”ฐ๋ผ ๋ณด๊ธฐ ์‰ฝ๊ฒŒ ๋‚˜ํƒ€๋‚ธ๊ฒƒ.

ํ‘œ ์•ˆ์— ์ œ๋ชฉ๊ณผ ๋‚ด์šฉ์œผ๋กœ ๊ตฌ์„ฑํ•ด์•ผํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค๋ฅธ ๋งˆํฌ์—… ํƒœ๊ทธ๋“ค๋ณด๋‹ค ์‚ฌ์šฉ๋ฐฉ๋ฒ•์ด ์ข€ ๋” ๋ณต์žก

ํ‘œ ํ˜•ํƒœ์˜ UI์ด๋”๋ผ๋„ ๋‹ค๋ฅธ ํƒœ๊ทธ๋กœ ์˜๋ฏธ์žˆ๋Š” ๋งˆํฌ์—…์„ ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ๊ผญ ํ…Œ์ด๋ธ” ํƒœ๊ทธ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค.

์‚ฌ์šฉ ์˜ˆ์‹œ

๋„ค์ด๋ฒ„ ์Šคํฌ์ธ : ๊ธฐ๋ก ์ˆœ์œ„
๋„ค์ด๋ฒ„ ํฌ์ŠคํŠธ: ํ†ต๊ณ„, ๋‹ฌ๋ ฅ

ํ…Œ์ด๋ธ” ์ž‘์„ฑ ์‹œ ์ฃผ์˜์‚ฌํ•ญ

ํ…Œ์ด๋ธ” != ์ผ๋ฐ˜ ๋ธ”๋Ÿญ ์š”์†Œ

  • ํ…Œ์ด๋ธ” ์ ‘๊ทผ์„ฑ
  • ์…€์˜ ํฌ๊ธฐ
  • ์…€ ์•ˆ์—์„œ์˜ ์ฝ˜ํ…์ธ  ์ •๋ ฌ
  • ํ…Œ์ด๋ธ”์˜ ํ…Œ๋‘๋ฆฌ
  • ํ…Œ์ด๋ธ”๊ณผ position
  • ๋ณต์žกํ•œ ํ…Œ์ด๋ธ”์„ ๋ฆฌ๋”๊ธฐ๊ฐ€ ์ œ๋Œ€๋กœ ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก ์ ‘๊ทผ์„ฑ์„ ์ง€์ผœ์„œ ๋งˆํฌ์—… ํ•˜๋Š” ๋ฐฉ๋ฒ•
  • ์…€์˜ ํฌ๊ธฐ์™€ ๊ทธ ์•ˆ์—์„œ ์ฝ˜ํ…์ธ ๋ฅผ ์–ด๋–ป๊ฒŒ ์ •๋ ฌํ•ด์•ผํ•˜๋Š”์ง€
  • ํ…Œ์ด๋ธ”์˜ ํ…Œ๋‘๋ฆฌ๋ฅผ ๊พธ๋ฐ€๋•Œ ์ฃผ์˜ํ•ด์•ผ ํ•  ๋ถ€๋ถ„๋“ค
  • position ์—ญ์‹œ ํ…Œ์ด๋ธ”์—์„œ ์ฃผ์˜ํ•ด์„œ ์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค.

ํ‘œ์˜ ์ ‘๊ทผ์„ฑ

์ ‘๊ทผ์„ฑ

scope
์ œ๋ชฉ ์…€์ธ ๋ชจ๋“  th์— ์ถ”๊ฐ€
th scope="col, row, colgroup, rowgroup"

๋ชจ๋“  <th>๋Š” ๋ฐ˜๋“œ์‹œ scope๋ผ๋Š” ์†์„ฑ์„ ์ถ”๊ฐ€ํ•ด์„œ <td>์˜ ๋‚ด์šฉ์ด ์–ด๋–ค <th>์— ๊ด€๋ จ๋œ ๊ฒƒ์ธ์ง€ ๋ฆฌ๋”๊ธฐ๊ฐ€ ์ œ๋Œ€๋กœ ์ฝ์–ด์ค„ ์ˆ˜ ์žˆ๋„๋ก ์ ‘๊ทผ์„ฑ์„ ์ง€์ผœ์ฃผ์–ด์•ผ ํ•œ๋‹ค.
scope์˜ ๊ฐ’์œผ๋กœ๋Š” 4๊ฐ€์ง€ ์˜ฌ ์ˆ˜ ์žˆ๋‹ค.

  • the scope="col/row"
    ์œ„์˜ ์ œ๋ชฉ ์…€๋“ค (์„ธ๋กœ๋ฐฉํ–ฅ) -> col ์—ด
    ์™ผ์ชฝ์˜ ์ œ๋ชฉ ์…€๋“ค(๊ฐ€๋กœ๋ฐฉํ–ฅ) -> row ํ–‰
    <thead>์— ์žˆ๋Š” <th>๋Š” ๋ชจ๋‘ scope=col
  • the scope="colgroup/rowgroup"
    ์ œ๋ชฉ์…€์ด ์†ํ•œ ์—ด or ํ–‰ ๊ทธ๋ฃน๊ณผ ๋ชจ๋‘ ๊ด€๋ จ์žˆ์„ ๊ฒฝ์šฐ ์‚ฌ์šฉ
    ์ž๊ธฐ์— ํ•ด๋‹นํ•˜๋Š” ํ–‰๊ณผ ์—ด์„ ๋Œ€ํ‘œํ•˜๋Š” ์ œ๋ชฉ์…€
    ๋”ฐ๋ผ์„œ ๋ณ‘ํ•ฉ๋œ ์…€์—์„œ ๋งŽ์ด ์‚ฌ์šฉ
<table>
  <col>
  <colgroup span="2"></colgroup>
  <colgroup span="2"></colgroup>
  <tr>
    <td rowspan="2"></td>
    <th colspan="2" scope="colgroup">Mars</th>
    <th colspan="2" scope="colgroup">Venus</th>
  </tr>
  <tr>
    <th scope="col">Produced</th>
    <th scope="col">Sold</th>
    <th scope="col">Produced</th>
    <th scope="col">Sold</th>
  </tr>
  <tr>
    <th scope="row">Teddy Bears</th>
    <td>50,000</td>
    <td>30,000</td>
    <td>100,000</td>
    <td>80,000</td>
  </tr>
  <tr>
    <th scope="row">Board Games</th>
    <td>10,000</td>
    <td>5,000</td>
    <td>12,000</td>
    <td>9,000</td>
  </tr>

id, headers
th id="" / td headers=""

๋ณต์žกํ•œ ํ‘œ์—์„œ ์‚ฌ์šฉ

๋ชจ๋“  th์— id ์ถ”๊ฐ€, ๊ฐ th์— ํ•ด๋‹นํ•˜๋Š” ์…€์— headers๋ฅผ ์ถ”๊ฐ€ํ•ด์„œ ๊ทธ ๊ฐ’์œผ๋กœ id๊ฐ’์„ ๋‚˜์—ด
์ฆ‰ th์™€ td๋ฅผ ์ง์ ‘์—ฐ๊ฒฐํ•˜๋Š” ๋ฐฉ์‹

๋ฆฌ๋”๊ธฐ๋Š” ์ ์–ด์ค€ ์ˆœ์„œ๋Œ€๋กœ headrs๋ฅผ ์ฝ์Œ
๋ณต์žกํ•ด์„œ ์˜ค๋ฅ˜๊ฐ€ ๋‚˜๊ธฐ ์‰ฌ์›€
๋Œ€๋ถ€๋ถ„ scope๋งŒ์œผ๋กœ ์ ‘๊ทผ์„ฑ์„ ์ถฉ๋ถ„ํžˆ ์ง€ํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

<table>
<caption>
    Availability of holiday accommodation
</caption>
<thead>
    <tr>
        <td></td>
        <th id="stud" scope="col">Studio</th>
        <th id="apt" scope="col">Apt</th>
        <th id="chal" scope="col">Chalet</th>
        <th id="villa" scope="col">Villa</th>
    </tr>
</thead>
<tbody>
    <tr>
        <th id="par" colspan="5" scope="colgroup">Paris</th>
    </tr>
    <tr>
        <th headers="par" id="pbed1">1 bedroom</th>
        <td headers="par pbed1 stud">11</td>
        <td headers="par pbed1 apt">20</td>
        <td headers="par pbed1 chal">25</td>
        <td headers="par pbed1 villa">23</td>
    </tr>
</tbody>
</table>

ํ‘œ์™€ Position ์†์„ฑ

table ์š”์†Œ ๋‚ด์—์„œ CSS position ์†์„ฑ์„ ์‚ฌ์šฉํ•  ๋•Œ ๋ธŒ๋ผ์šฐ์ €๋งˆ๋‹ค ์–ด๋–ป๊ฒŒ ๋ Œ๋”๋ง ๋˜๋Š”์ง€ ์‚ดํŽด๋ณด์ž

<div class="wrap">
  <table class="td_relative">
    <caption>td์— relative</caption>
    <tr>
      <td class="relative_section">
        <div class="absolute_section"></div>
      </td>
    </tr>
  </table>
</div>

<div class="wrap">
  <table class="tr_relative">
    <caption>tr์— relative</caption>
    <tr class="relative_section">
      <td>
        <div class="absolute_section"></div>
      </td>
    </tr>
  </table>
</div>

<div class="wrap">
  <table class="table_relative relative_section">
  <caption>table์— relative</caption>
    <tr>
      <td>
        <div class="absolute_section"></div>
      </td>
    </tr>
  </table>
</div>

<div class="wrap div_relative">
  <table>
  <caption>div์— relative</caption>
    <tr>
      <td>
        <div class="relative_section">
          <div class="absolute_section"></div>
        </div>
      </td>
    </tr>
  </table>
table {
border: 1px solid #000;
table-layout: fixed;
width: 100%;
height: 150px;
border-collapse: collapse;
}
.td_relative {
border-color: red;
}
.tr_relative {
border-color: blue;
}
.table_relative {
border-color: green;
}

.wrap {
margin: 50px;
}
.relative_section {
position: relative;
}
.absolute_section {
position: absolute;
width: 30px;
height: 30px;
left: 0;
top: 0;
background-color: #000;
}
.td_relative .absolute_section {
background-color: red;
}
.tr_relative .absolute_section {
background-color: blue;
}
.table_relative .absolute_section {
background-color: green;
}
.div_relative .relative_section {
width: 100%;
height: 100%;
}

๊ฒฐ๊ณผ

๋ฐ•์Šค์˜ ์œ„์น˜๊ฐ€ ๋ธŒ๋ผ์šฐ์ €๋งˆ๋‹ค ๋ชจ๋‘ ๋‹ค๋ฅด๊ฒŒ ๋ Œ๋”๋ง๋จ
-> ํ…Œ์ด๋ธ”์„ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ•ด์„ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋ชจ๋‘ ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•˜๋Š” ํ˜„์ƒ

  • td์— ์ง์ ‘ relative๋ฅผ ์คฌ์„๋•Œ ๊ฐ€์žฅ ์ •์ƒ์ ์œผ๋กœ ๋…ธ์ถœ. ์•ˆ์— ์š”์†Œ๋“ค์ด ์–ด๋–ป๊ฒŒ ์˜ค๋ƒ์— ๋”ฐ๋ผ์„œ ๋ณต์žก๋„์— ๋”ฐ๋ผ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋ฒ„๊ทธ ๋ฐœ์ƒ ๊ฐ€๋Šฅ

  • ๋‚ด๋ถ€ div์— relative๋ฅผ ์คฌ์„๋•Œ IE ํ•˜์œ„๋ฒ„์ „๊ณผ ํŒŒ์ด์–ดํญ์Šค์—์„œ ์ค‘์•™์— ์œ„์น˜ํ•˜๋Š”๊ฑด ์…€๊ณผ ์…€ ์•ˆ์— ๋†’์ด๊ฐ’๊ณผ ์ปจํ…์ธ ๊ฐ€ ์—†๊ธฐ ๋•Œ๋ฌธ. ๊ทธ๋ž˜์„œ ์…€๊ณผ div ๋†’์ด๊ฐ’์„ 0px๋กœ ์ฒ˜๋ฆฌํ•˜๊ณ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ค‘์•™์— ์œ„์น˜. ๊ทธ๋ž˜์„œ div์•ˆ์— ์š”์†Œ๋“ค์ด ๋งŽ์ด ๋“ค์–ด๊ฐ„๋‹ค๋ฉด ์ •์ƒ์ ์œผ๋กœ ๋†’์ด๊ฐ’์„ ์žก๊ธฐ ๋•Œ๋ฌธ์— ๋ Œ๋”๋ง ์ž˜ ๋จ

๋”ฐ๋ผ์„œ ํ…Œ์ด๋ธ”์€ ๊ฐ ์š”์†Œ๋ฅผ ๋ฐฐ์น˜ํ•˜๋Š” ํ‹€๋กœ ๋ณด๊ณ  td๋‚˜ th์˜ ์…€ ์•ˆ์— inner DIV๋ฅผ ์ถ”๊ฐ€ํ•จ์œผ๋กœ์จ position ์š”์†Œ๋‚˜ ๊ทธ ๋ฐ–์— ๊พธ๋ฏธ๋Š” ์š”์†Œ๋“ค์€ ๋ชจ๋‘ ์ด ๋‚ด๋ถ€ div์— ์ง์ ‘ ์„ ์–ธํ•˜๋Š”๊ฒƒ์ด ์ข‹๋‹ค.
table์€ ํฌ๋กœ์Šค ๋ธŒ๋ผ์šฐ์ง•์— ํŠนํžˆ ์‹ ๊ฒฝ์„ ์จ์•ผํ•˜๋‹ˆ ์ฃผ์˜


ํ‘œ์™€ Border ์†์„ฑ

ํ…Œ์ด๋ธ”์— border๊ฐ€ ์ ์šฉ๋˜๋Š” ๋ฐฉ์‹

  • border-collapse:separate; (default)

    ๋ชจ๋“  ํ…Œ์ด๋ธ” ์š”์†Œ์— border๊ฐ€ ์‚ด์•„์žˆ์Œ
    ๋ Œ๋”๋ง
    : thead->tfoot->tbody์ˆœ์œผ๋กœ ๋ผ์ธ์ด ๊ทธ๋ ค์ง€๊ณ  ์ฝ˜ํ…์ธ ๊ฐ€ ์ฑ„์›Œ์ง

  • border-collapse:collapse;

    border ๋ณ‘ํ•ฉ
    ์šฐ์ธก ํ•˜๋‹จ๋ถ€ํ„ฐ ์ขŒ์ธก ์ƒ๋‹จ์œผ๋กœ ๋ Œ๋”๋ง


ํ…Œ์ด๋ธ” ์š”์†Œ๋Š” ๋ ˆ์ด์–ด๋กœ ์Œ“์ด๊ธฐ ๋•Œ๋ฌธ์— z-index ์ฐจ์ด๊ฐ€ ์žˆ๋‹ค.
table ์š”์†Œ๊ฐ€ ๊ฐ€์žฅ ๋จผ์ € ๊ทธ๋ ค์ง€๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค๋ฅธ ์…€๋“ค์— ๊ฐ€๋ ค์ ธ์„œ ๋ณด์ด์ง€ ์•Š๋Š”๊ฒƒ

columns, column groups : colgroup, col๋ฅผ ์˜๋ฏธ
์—ฌ๊ธฐ์— CSS๋กœ border๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ๋Š”๋ฐ ๋น„๊ต์  ๋‹ค๋ฅธ ์…€๋“ค์— ๋น„ํ•ด z-index๊ฐ€ ๋‚ฎ์•„์„œ ๊ฐ€๋ ค์ง€๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๊ธฐ ๋•Œ๋ฌธ์— ์ž˜ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ

z-index ์ˆœ์„œ
table<col<tbody<thead<tr<td<th

ํ†ต๊ณ„ํ‘œ ์ œ์ž‘

๋„ค์ด๋ฒ„ ํฌ์ŠคํŠธ ์„œ๋น„์Šค์˜ ํ†ต๊ณ„ํ‘œ ์ œ์ž‘

์Šคํƒ€์ผ ์ •๋ณด

  • ํ‘œ ๋„ˆ๋น„ : 500px
  • ๊ฐ ์…€ ๋†’์ด : 40px
  • ์—ฐ๋ น๋ณ„ ์„ฑ๋ณ„์˜ ๋„ˆ๋น„ : 90px
  • ์กฐํšŒ์ˆ˜, ๋น„์œจ ํ…์ŠคํŠธ ์ •๋ ฌ : ์˜ค๋ฅธ์ชฝ

์ฃผ์š” ํƒœ๊ทธ ๋ฐ ์†์„ฑ

  • HTML
    table, caption, colgroup, col, thead, tbody, th, td
    (์†์„ฑ : scope, rowspan, colspan)
  • CSS
    table-layout, border-collapse, padding, border, color, text-align, background-color

<table>
<caption>์„ฑ๋ณ„, ์—ฐ๋ น๋ณ„ ๋ถ„ํฌ ๋ชฉ๋ก</caption>
<colgroup>
  	<!--span : col ๋ณ‘ํ•ฉ-->
	<col span="2" class="col">
	<col span="2">
</colgroup>
<thead>
<tr>
	<th scope="col">์—ฐ๋ น๋ณ„</th>
	<th scope="col">์„ฑ๋ณ„</th>
	<th scope="col" class="th_view">์กฐํšŒ์ˆ˜</th>
	<th scope="col" class="th_rate">๋น„์œจ</th>
</tr>
</thead>
<tbody>
<tr>
	<th rowspan="2" scope="rowgroup">์ „์ฒด</th>
	<th scope="row" class="th_male">๋‚จ</th>
	<td>0</td>
	<td>0.0%</td>
</tr>
<tr>
	<th scope="row" class="th_female">์—ฌ</th>
	<td>0</td>
	<td>0.0%</td>
</tr>
<tr>
	<th rowspan="2" scope="rowgroup">0-12</th>
	<th scope="row" class="th_male">๋‚จ</th>
	<td>0</td>
	<td>0.0%</td>
</tr>
<tr>
	<th scope="row" class="th_female">์—ฌ</th>
	<td>0</td>
	<td>0.0%</td>
</tr>
</tbody>
</table>
table, td, th {
	border-collapse: collapse;
}

table {
	width: 500px; /*์ „์ฒด๊ฐ€ 500px์ด ๋˜๊ณ  ๊ฐ ์…€์˜ ๋„ˆ๋น„๋Š” ๋‚ด์šฉ์˜ ๊ธธ์ด์— ๋”ฐ๋ผ์„œ ์ž๋™ ๋ถ„๋ฐฐ๋จ*/
	table-layout: fixed; /*์…€์˜ ํฌ๊ธฐ๋ฅผ ๋™์ผํ•˜๊ฒŒ ๋งž์ถค*/
	font-size: 13px;
}

.col {
	width: 90px;
}

th {
	font-weight: normal; /*์ดˆ๊ธฐํ™”*/
}

th, td {
	border-bottom: 1px solid #e1e1e1;
}

thead th {
	padding: 5px 0;
	border-bottom: 2px solid #000;
}

tbody td {
	height: 40px;
}

.th_view,
.th_rate,
tbody td {
	text-align: right;
}

.th_male,
.th_female {
	background: #f8f8f8;
}

table-fixed ์†์„ฑ
: ๋ˆˆ์— ๋ณด์ด๋Š” ํšจ๊ณผ ๋•Œ๋ฌธ์ด ์•„๋‹ˆ๋ผ ์„ฑ๋Šฅ ๋•Œ๋ฌธ์— ๋ฐ˜๋“œ์‹œ ํ•„์š”ํ•œ ์†์„ฑ
<table> ํƒœ๊ทธ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ display:table์—์„œ๋„ table-layout:fixed๋ฅผ ์“ฐ๊ณ  ์•ˆ์“ฐ๊ณ ์— ๋”ฐ๋ผ ์„ฑ๋Šฅ ์ฐจ์ด๊ฐ€ ๊ต‰์žฅํžˆ ๋งŽ์ด ๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ˜๋“œ์‹œ ์ถ”๊ฐ€ํ•˜๊ธฐ

col์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์Šคํƒ€์ผ
width/background/border


๋‹ฌ๋ ฅ ์ œ์ž‘

ํ…Œ์ด๋ธ” ํƒœ๊ทธ๋กœ ๋งŒ๋“ค์–ด์•ผ ํ•˜๋Š” ๋Œ€ํ‘œ์ ์ธ UI์ธ ๋‹ฌ๋ ฅ

์Šคํƒ€์ผ ์ •๋ณด

  • ํ‘œ ์ „์ฒด ๋„ˆ๋น„ : 590px
  • ์…€ ๋„ˆ๋น„ : ๋™์ผ
  • ์š”์ผ ์…€ ๋†’์ด : 25px
  • ๋‚ ์งœ ์…€ ๋†’์ด : 80px
  • ๊ธฐ๋…์ผ ํ…์ŠคํŠธ : ๋ง์ค„์ž„

<td>์•ˆ์— <div>๋ฅผ ์ถ”๊ฐ€ํ•ด์„œ ์Šคํƒ€์ผ์„ ๊พธ๋ฉฐ์ฃผ๋Š”๊ฒŒ ์•ˆ์ „
=inner <div>
์™œ? ๋ธŒ๋ผ์šฐ์ €๋งˆ๋‹ค ํ…Œ์ด๋ธ”์„ ๋ Œ๋”๋ง ํ•˜๋Š” ๋ฐฉ์‹์ด ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ

์ฃผ์š” ํƒœ๊ทธ ๋ฐ ์†์„ฑ

  • HTML
    table, caption, thead, tbody, th, td
    (์†์„ฑ : scope)
  • CSS
    table-layout, border-collapse, padding, border, color, text-align, background-color, position, margin, vertical-align, ๋ง์ค„์ž„(overflow, text-overflow, white-space)

์…€ ์•ˆ์— ์š”์†Œ๋“ค์ด ๋งŽ์œผ๋ฏ€๋กœ inner๋ผ๋Š” ํด๋ž˜์Šค์— <div>๋ฅผ ํ•˜๋‚˜ ์ถ”๊ฐ€

<table>
<caption>๋‹ฌ๋ ฅ</caption>
<thead>
<tr>
	<th scope="col">์ผ</th>
	<th scope="col">์›”</th>
	<th scope="col">ํ™”</th>
	<th scope="col">์ˆ˜</th>
	<th scope="col">๋ชฉ</th>
	<th scope="col">๊ธˆ</th>
	<th scope="col">ํ† </th>
</tr>
</thead>
<tbody>
<tr>
	<td>
		<div class="inner">
			<span class="date dimmed">30</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">1</span>
			<em class="text anniversary">๊ตญ๊ตฐ์˜ ๋‚ ๊ตญ๊ตฐ์˜ ๋‚ ๊ตญ๊ตฐ์˜ ๋‚ ๊ตญ๊ตฐ์˜ ๋‚ </em>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">2</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date holiday">3</span>
			<em class="text holiday">๊ฐœ์ฒœ์ ˆ</em>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">4</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">5</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">6</span>
		</div>
	</td>
</tr>
<tr>
	<td>
		<div class="inner">
			<span class="date holiday">7</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">8</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date holiday">9</span>
			<em class="text holiday">ํ•œ๊ธ€๋‚ </em>
			<span class="lunar">์Œ 9.1
		</span></div>
	</td>
	<td class="today">
		<div class="inner">
			<span class="date">10</span>
			<strong class="blind">์˜ค๋Š˜</strong>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">11</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">12</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">13</span>
		</div>
	</td>
</tr>
<tr>
	<td>
		<div class="inner">
			<span class="date holiday">7</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">8</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date holiday">9</span>
			<em class="text holiday">ํ•œ๊ธ€๋‚ </em>
			<span class="lunar">์Œ 9.1</span>
		</div>
	</td>
	<td class="today">
		<div class="inner">
			<span class="date">10</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">11</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">12</span>
		</div>
	</td>
	<td>
		<div class="inner">
			<span class="date">13</span>
		</div>
	</td>
</tr>
</tbody>
</table>
.blind{
  position:absolute;
  clip:rect(0 0 0 0);
  width:1px;
  height:1px;
  margin:-1px;
  overflow:ใ…“hidden;
}

table, th {
	border: 1px solid #eaedef;
	border-collapse: collapse;
}

td { /*today ์…€์˜ top left border๊ฐ€๋ ค์ง ํ˜„์ƒ ํ•ด๊ฒฐ*/
	border-top: 1px solid #eaedef;
	border-left: 1px solid #eaedef;
    /*์˜ค๋ฅธ์ชฝ ํ•˜๋‹จ๋ถ€ํ„ฐ ์™ผ์ชฝ ์œ„๋กœ ๋ Œ๋”๋ง๋œ๋‹ค*/
    /*table์—์„œ ํฌ๋กœ์Šค ๋ธŒ๋ผ์šฐ์ง•๋งŒํผ ์‹ ๊ฒฝ์จ์•ผ ํ•  ๋ถ€๋ถ„์ด ๋ฐ”๋กœ ์ด ๋ผ์ธ์ฒ˜๋ฆฌ*/
}


table {
	width: 590px;
	table-layout: fixed; /*์…€ ๊ท ๋“ฑ ๋ถ„ํ• , ์„ฑ๋Šฅ ์ด์Šˆ๋กœ ๋ฐ˜๋“œ์‹œ ์ถ”๊ฐ€*/
	font-size: 12px;
}

th {
	height: 25px;
	color: #777;
}

.inner {
	/*td๊ฐ€ ์•„๋‹Œ inner div์— relative ์ฃผ๋Š”๊ฑฐ ๊ผญ ๊ธฐ์–ตํ•˜๊ธฐ*/
	position: relative; /*.lunar์˜ ๋ถ€๋ชจ*/
	height: 70px; /*padding ํฌํ•จํ•˜๋ฉด ์ด 80px*/
	padding: 5px;
}

.date {
	font-weight: bold;
}

.text {
	display: block; /*์ค„๋ฐ”๊ฟˆ*/
	margin-top: 3px;
	font-style: normal; /*em ์Šคํƒ€์ผ ์ดˆ๊ธฐํ™”*/
    /*๋ง์ค„์ž„ ์ฒ˜๋ฆฌ*/
	white-space: nowrap; /*์ค„๋ฐ”๊ฟˆ ์•ˆ๋˜๊ฒŒ*/
	overflow: hidden; /*๊ธ€ ์ž˜๋ฆฌ๊ฒŒ*/
	text-overflow: ellipsis; /*...*/
}

.date.dimmed {
	color: #e7e7e7;
}

.date.holiday {
	color: #f44e4e;
}

.text.holiday {
	color: #f44e4e;
}

.text.anniversary {
	color: #00c;
}

.lunar {
	position: absolute;
	top: 6px;
	right: 6px;
	font-size: 11px;
	color: #bababa;
}

.today {
	border: 1px solid #e0e0bf;
	background: #ffffd9;
}

ํ‘œ ์š”์•ฝ ์ •๋ฆฌ

ํ…Œ์ด๋ธ” ์ ‘๊ทผ์„ฑ

th scope="col, row, clogroup, rowgroup"
์ œ๋ชฉ ์…€์ธ ๋ชจ๋“  th์— ์ถ”๊ฐ€

  • col: ์„ธ๋กœ, ์—ด์— ๋Œ€ํ•œ ์ œ๋ชฉ์— ์ž‘์„ฑ
  • row: ๊ฐ€๋กœ, ํ–‰์— ๊ด€๋ จ๋œ ์ œ๋ชฉ
  • colgroup, rowgroup: ํ•ด๋‹น ์—ด๊ณผ ํ–‰์„ ๋Œ€ํฌํ•˜๋Š” ๊ฒฝ์šฐ. ๋ณดํ†ต ์…€์ด ๋ณ‘ํ•ฉ๋˜์—ˆ์„๋•Œ ๋งŽ์ด ์‚ฌ์šฉ

th id="", td headers=""
์•„์ฃผ ๋ณต์žกํ•œ ํ‘œ์—์„œ ์‚ฌ์šฉํ•˜์ง€๋งŒ, ๋Œ€๋ถ€๋ถ„ scope๋กœ ์ ‘๊ทผ์„ฑ ํ•ด๊ฒฐ ๊ฐ€๋Šฅ

์…€์˜ ํฌ๊ธฐ

์…€์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•ด ์ฃผ์ง€ ์•Š์•˜์„ ๊ฒฝ์šฐ, ๋‚ด์šฉ์— ๋งž๊ฒŒ ๋ณ€ํ•จ
ํ‘œ์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ–ˆ์„ ๊ฒฝ์šฐ, ๊ฐ ์…€์˜ ๋„ˆ๋น„๋Š” ์ž๋™๋ถ„ํ• 

table-layout:fixed;๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋‚ด์šฉ๊ณผ ์ƒ๊ด€์—†์ด ๋ชจ๋“  ์…€์˜ ๋„ˆ๋น„๊ฐ€ ๊ท ๋“ฑํ•˜๊ฒŒ ๋ถ„ํ• ๋จ
์„ฑ๋Šฅ ์ด์Šˆ๋•Œ๋ฌธ์— ๋ฐ˜๋“œ์‹œ ์‚ฌ์šฉํ•ด์ค˜์•ผ ํ•œ๋‹ค.

์…€ ์•ˆ์—์„œ์˜ ์ฝ˜ํ…์ธ  ์ •๋ ฌ

  • ์ œ๋ชฉ ์…€(th)
    • text-align:center;
    • vertical-align:middle;
  • ๋‚ด์šฉ ์…€ (td)
    • text-align:left;
    • vertical-algin:middle;

ํ…Œ์ด๋ธ”์˜ ํ…Œ๋‘๋ฆฌ

  • ๊ธฐ๋ณธ ๋ชจ์–‘์€ ํ…Œ๋‘๋ฆฌ๊ฐ€ ์—†์Œ
    ํ•„์š”์— ๋”ฐ๋ผ ํ…Œ์ด๋ธ” ์š”์†Œ์— border์†์„ฑ ์ ์šฉ

  • ํ…Œ์ด๋ธ” ํ…Œ๋‘๋ฆฌ ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ ์ œ๊ฑฐ
    ํ…Œ์ด๋ธ” ํ…Œ๋‘๋ฆฌ ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์€ ๊ธฐ๋ณธ๊ฐ’์ด seperate.
    ๋ชจ๋“  border๋“ค์ด ๊ฐ„๊ฒฉ์ด ๋–จ์–ด์ ธ์„œ ํ…Œ์ด๋ธ”์— ์ ์šฉ๋œ ์™ธ๊ณฝ์„ ๊นŒ์ง€ ๋ชจ๋‘ ๋ณด์ด๋Š”๊ฒŒ ๊ธฐ๋ณธ๊ฐ’
    border-collapse:collapse ์‚ฌ์šฉ์‹œ border ๋ณ‘ํ•ฉ,
    ํ…Œ์ด๋ธ”์ด ๋ Œ๋”๋ง๋˜๋Š” ๋ฐฉ์‹ ๋•Œ๋ฌธ์— (์˜ค๋ฅธ์ชฝ ์•„๋ž˜์—์„œ ์™ผ์ชฝ ์œ„๋กœ ๋ Œ๋”๋ง)
    border์˜ left, top์ด ๊ฐ€๋ ค์ง€๋Š” ํ˜„์ƒ ๋ฐœ์ƒ
    ๋”ฐ๋ผ์„œ table์˜ border๋Š” ์‹ ๊ฒฝ์„ ์จ์„œ css ์ž‘์„ฑํ•ด์•ผํ•จ

colgroup, col

width, background, border๋ฅผ ํ•ด๋‹น ์—ด์— ์ผ๊ด„ ์ ์šฉ ๊ฐ€๋Šฅ
colgroup๊ณผ col์˜ z-index๊ฐ€ ํ…Œ์ด๋ธ” ์š”์†Œ ๋‚ด์—์„œ ๋‚ฎ์€ ํŽธ์ด๋ฏ€๋กœ width์†์„ฑ์„ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ
width๊ฐ’์„ col์— ์ง์ ‘ ์ ์–ด์ฃผ๋Š”๊ฒƒ์€ HTML5์—์„œ ๋” ์ด์ƒ ์ง€์›ํ•˜์ง€ ์•Š์œผ๋ฏ€๋กœ class๋‚˜ style๋กœ ์ฒ˜๋ฆฌ
col span=""์œผ๋กœ ๋ณ‘ํ•ฉ ๊ฐ€๋Šฅ

ํ…Œ์ด๋ธ”๊ณผ position

ํ…Œ์ด๋ธ” ์š”์†Œ, ํŠนํžˆ <td>๋Š” ๊ฐ ์š”์†Œ๋ฅผ ๋ฐฐ์น˜ํ•˜๋Š” ํ‹€๋กœ ๋ณด๊ณ  td/th๋“ฑ์˜ ์•ˆ์— inner DIV๋ฅผ ๋ฐ˜๋“œ์‹œ ์ถ”๊ฐ€ํ•ด์„œ ์•ˆ์ •์ ์œผ๋กœ ๋งˆํฌ์—…ํ•ด๋ผ
์™œ๋ƒ๋ฉด ํ…Œ์ด๋ธ”์€ ํฌ๋กœ์Šค ๋ธŒ๋ผ์šฐ์ง•ํ•˜๊ธฐ ๊ต‰์žฅํžˆ ์–ด๋ ค์šด ํƒœ๊ทธ์ค‘ ํ•˜๋‚˜์ด๊ธฐ ๋•Œ๋ฌธ
๊ทธ๋ž˜์„œ ์š”์†Œ๋“ค์ด ๋งŽ์ด ๋“ค์–ด์˜ค๊ฒŒ ๋˜๋ฉด ๊ทธ ๋ณต์žก๋„์— ๋”ฐ๋ผ์„œ ์–ด๋–ค ๋ฒ„๊ทธ๊ฐ€ ์ƒ๊ธธ์ง€ ์˜ˆ์ธกํ•˜๊ธฐ ์–ด๋ ต๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€