border-collapse
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
border-collapse CSS ìì±ì í í
ë리(border)ê° ë¶ë¦¬(separated) ëë ìì(collapsed)ë ì§ë¥¼ ê²°ì í©ëë¤. ë¶ë¦¬ 모ë¸ììë, ì¸ì í ì
ì ê°ê° ìì ì ê³ ì (distinct) í
ëë¦¬ê° ììµëë¤. ìì 모ë¸ììë, ì¸ì í í ì
ì í
ë리를 ê³µì í©ëë¤.
ìëí´ ë³´ê¸°
border-collapse: collapse;
border-collapse: separate;
<section class="default-example" id="default-example">
<table class="transition-all" id="example-element">
<tr>
<td>Cell 1.1</td>
<td>Cell 1.2</td>
</tr>
<tr>
<td>Cell 2.1</td>
<td>Cell 2.2</td>
</tr>
<tr>
<td>Cell 3.1</td>
<td>Cell 3.2</td>
</tr>
</table>
</section>
table {
width: 15rem;
table-layout: fixed;
}
td {
border: 5px solid;
border-color: crimson dodgerblue orange limegreen;
padding: 0.75rem;
}
ë¶ë¦¬(separated) 모ë¸ì HTML í í
ë리 ì íµ ëª¨ë¸ì
ëë¤. ì¸ì ì
ì ê°ê° ìì ì ê³ ì í
ëë¦¬ê° ììµëë¤. ê·¸ ì¬ì´ì ê°ê²©ì border-spacing ìì±ì ìí´ ì£¼ì´ì§ëë¤.
ìì(collapsed) í
ë리 모ë¸ììë, ì¸ì í ì
ì í
ë리를 ê³µì í©ëë¤. ê·¸ 모ë¸ììë, insetì border-style ê°ì grooveì²ë¼, outsetì ridgeì²ë¼ íëí©ëë¤.
구문
/* Keyword values */
border-collapse: collapse;
border-collapse: separate;
/* Global values */
border-collapse: inherit;
border-collapse: initial;
border-collapse: unset;
ê°
íì 구문
border-collapse =
separate |
collapse
ìì
>ë¸ë¼ì°ì ìì§ì ë¤ì í
HTML
<table class="separate">
<caption>
<code>border-collapse: separate</code>
</caption>
<tbody>
<tr>
<th>Browser</th>
<th>Layout Engine</th>
</tr>
<tr>
<td class="fx">Firefox</td>
<td class="gk">Gecko</td>
</tr>
<tr>
<td class="ie">Internet Explorer</td>
<td class="tr">Trident</td>
</tr>
<tr>
<td class="sa">Safari</td>
<td class="wk">Webkit</td>
</tr>
<tr>
<td class="ch">Chrome</td>
<td class="bk">Blink</td>
</tr>
<tr>
<td class="op">Opera</td>
<td class="bk">Blink</td>
</tr>
</tbody>
</table>
<table class="collapse">
<caption>
<code>border-collapse: collapse</code>
</caption>
<tbody>
<tr>
<th>Browser</th>
<th>Layout Engine</th>
</tr>
<tr>
<td class="fx">Firefox</td>
<td class="gk">Gecko</td>
</tr>
<tr>
<td class="ie">Internet Explorer</td>
<td class="tr">Trident</td>
</tr>
<tr>
<td class="sa">Safari</td>
<td class="wk">Webkit</td>
</tr>
<tr>
<td class="ch">Chrome</td>
<td class="bk">Blink</td>
</tr>
<tr>
<td class="op">Opera</td>
<td class="bk">Blink</td>
</tr>
</tbody>
</table>
CSS
.collapse {
border-collapse: collapse;
}
.separate {
border-collapse: separate;
}
table {
display: inline-table;
margin: 1em;
border: dashed 6px;
border-width: 6px;
}
table th,
table td {
border: solid 3px;
}
.fx {
border-color: orange blue;
}
.gk {
border-color: black red;
}
.ie {
border-color: blue gold;
}
.tr {
border-color: aqua;
}
.sa {
border-color: silver blue;
}
.wk {
border-color: gold blue;
}
.ch {
border-color: red yellow green blue;
}
.bk {
border-color: navy blue teal aqua;
}
.op {
border-color: red;
}
ê²°ê³¼
ëª ì¸
| Specification |
|---|
| Cascading Style Sheets Level 2 > # propdef-border-collapse > |
ë¸ë¼ì°ì í¸íì±
ê°ì´ 보기
border-spacing,border-style- The
border-collapseproperty alters the appearance of the<table>HTML element.