HTML CSS Reference/CSS Attributes and Javascript Style Properties/border collapse

Материал из Web эксперт
Перейти к: навигация, поиск

"border-collapse" Example

    
<html>
<body>
<table id="myEle" border="1" style="border-collapse:collapse">
<tr>
   <td>column 1</td>
   <td>column 2</td>
   <td>column 3</td>
</tr>
<tr>
   <td>cell 1</td>
   <td>cell 2</td>
   <td>cell 3</td>
</tr>
<tr>
   <td>cell 1</td>
   <td>cell 2</td>
   <td>cell 3</td>
</tr>
</table>
<button onclick="myEle.style.borderCollapse="separate"">separate</button>
<button onclick="myEle.style.borderCollapse="collapse"">collapse</button>
</body>
</html>



"border-collapse" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <acronym>                     |
|                |<b>                             <bdo>                         |
|                |<big>                           <blockquote>                  |
|                |<body>                          <button>                      |
|                |<caption>                       <center>                      |
|                |<cite>                          <code>                        |
|                |<custom>                        <dd>                          |
|                |defaults                        <del>                         |
|                |<dfn>                           <dir>                         |
|                |<div>                           <dl>                          |
|                |<dt>                            <em>                          |
|                |<embed>                         <fieldset>                    |
|                |<font>                          <form>                        |
|                |<frame>                         <hn>                          |
|                |<i>                             <img>                         |
|                |<input type="button">           <input type="checkbox">       |
|                |<input type="file">             <inputtype="image">           |
|                |<input type="password">         <input type="radio">          |
|                |<input type="reset">            <input type="submit">         |
|                |<input type="text">             <ins>                         |
|                |<isindex>                       <kbd>                         |
|                |<label>                         <li>                          |
|                |<listing>                       <marquee>                     |
|                |<menu>                          <nobr>                        |
|                |<object>                        <ol>                          |
|                |<p>                             <pre>                         |
|                |<q>                             runtimeStyle                  |
|                |<s>                             <samp>                        |
|                |<small>                         <span>                        |
|                |<strike>                        <strong>                      |
|                |style                           <sub>                         |
|                |<sup>                           <table>                       |
|                |<td>                            <textarea>                    |
|                |<th>                            <tt>                          |
|                |<u>                             <ul>                          |
|                |<var>                           <xmp>                         |
+----------------+--------------------------------------------------------------+



"border-collapse" Possible Values

Possible Values
collapse    no space between borders.
separate    the default; borders are rendered separately.



"border-collapse" Syntax and Note

Note:
Whether or not the table elements (cells, rows, and columns) borders are 
rendered in space.
Syntax:
    
element { border-collapse: value }
elementID.style.borderCollapse = "value"
document.all.elementID.style.borderCollapse = "value" // IE only