Felix A J
Felix A J

Reputation: 6480

border-collapse using HTML attribute

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>

Upvotes: 5

Views: 24453

Answers (3)

Franck Dang
Franck Dang

Reputation: 5

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>[email protected]</td>
      </tr>
      <tr>
        <td>Mary</td>
        <td>Moe</td>
        <td>[email protected]</td>
      </tr>
      <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>[email protected]</td>
      </tr>
    </tbody>
  </table>
</div>

Upvotes: -1

divy3993
divy3993

Reputation: 5810

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.

Upvotes: 12

Justinas
Justinas

Reputation: 43479

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

Upvotes: 0

Related Questions