5

Is there an HTML attribute available equivalent to the CSS property border-collapse: collapse;?

I am trying to achieve the same 1px border with HTML only, and not using css.

table{
  border-collapse: collapse;
}
<table border="1px" cellpadding="3">
  <tr>
<td>Row 1</td>
<td>Row 1</td>
<td>Row 1</td>
  </tr>
  <tr>
<td>Row 2</td>
<td>Row 2</td>
<td>Row 2</td>
  </tr>
</table>
Felix A J
  • 6,300
  • 2
  • 27
  • 46

3 Answers3

12

You could try cellspacing.

<table border="1px" cellspacing="0" cellpadding="3">
  <tr>
<td>Row 1</td>
<td>Row 1</td>
<td>Row 1</td>
  </tr>
  <tr>
<td>Row 2</td>
<td>Row 2</td>
<td>Row 2</td>
  </tr>
</table>

Note: cellspacing doesn't overlap borders of adjacent cells, which CSS property does.

divy3993
  • 5,732
  • 2
  • 28
  • 41
0

You can use cellspacing or cellpadding but it's deprecated in HTML5

Justinas
  • 41,402
  • 5
  • 66
  • 96
0

i don't understand why you want to stop using CSS because that is what css do you can use boostrap the css is included inside. for more info go to w3chools

<div class="container">
  <h2>Basic Table</h2>
  <p>The .table class adds basic styling (light padding and only horizontal dividers) to a table:</p>
  <table class="table">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>Doe</td>
        <td>john@example.com</td>
      </tr>
      <tr>
        <td>Mary</td>
        <td>Moe</td>
        <td>mary@example.com</td>
      </tr>
      <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
      </tr>
    </tbody>
  </table>
</div>