Border-Collapse Using Html Attribute

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>

3 Answers

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.

8

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.