How would you make a table of buttons, but no gaps in between the buttons?

javascript html css button html-table

47 观看

1回复

19 作者的声誉

I am working on a website, and realised, I don't know how to make no gaps in between the buttons. I took to the internet, but I can't form what I want into words. I want to make a table, but there be no gaps in between the buttons I put in the table.

If you can help, I would like the code to be restricted to html, CSS, and Javascript.

作者: Mystic Coding 的来源 发布者: 2017 年 12 月 27 日

回应 1


0

7103 作者的声誉

决定

The keys to getting there were the combination of border-collapse and a css reset for margin and padding.

table {
  border-collapse: collapse;
}
* {
  margin: 0;
  padding: 0;
}
<table>
  <thead>
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
      <th>Header 3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Cell 1.1</td>
      <td>Cell 1.2</td>
      <td>Cell 1.3</td>
    </tr>
    <tr>
      <td>Cell 2.1</td>
      <td>Cell 2.2</td>
      <td>Cell 2.3</td>
    </tr>
    <tr>
      <td>Cell 3.1</td>
      <td>Cell 3.2</td>
      <td>Cell 3.3</td>
    </tr>
    <tr>
      <td>
        <button>Button 4.1</button>
      </td>
      <td>
        <button>Button 4.2</button>
      </td>
      <td>
        <button>Button 4.3</button>
      </td>
    </tr>
    <tr>
      <td>
        <button>Button 5.1</button>
      </td>
      <td>
        <button>Button 5.2</button>
      </td>
      <td>
        <button>Button 5.3</button>
      </td>
    </tr>
  </tbody>
</table>

作者: Shilly 发布者: 2017 年 12 月 27 日
32x32