Home > Web Front-end > CSS Tutorial > How Can I Add a Bottom Border to Each Row in an HTML Table?

How Can I Add a Bottom Border to Each Row in an HTML Table?

DDD
Release: 2024-12-14 00:29:11
Original
949 people have browsed it

How Can I Add a Bottom Border to Each Row in an HTML Table?

Add Border to Bottom of Table Row

You encounter an issue when attempting to add a solid black border to the bottom of each table row (). Employing inline styles or CSS initially proved ineffective.

To rectify this, incorporate border-collapse: collapse; within the table rule in your CSS:

table {
    border-collapse: collapse;
}
Copy after login

This modification essentially merges adjacent borders, ensuring that the borders applied to individual rows are visible.

Code Example:

<table>
  <tr><td>A1</td><td>B1</td><td>C1</td></tr>
  <tr><td>A2</td><td>B2</td><td>C2</td></tr>
  <tr><td>A2</td><td>B2</td><td>C2</td></tr>
</table>
Copy after login
table {
  border-collapse: collapse;
}

tr {
  border-bottom: 1pt solid black;
}
Copy after login

Upon applying this CSS, the borders between rows in the table become visible as expected.

The above is the detailed content of How Can I Add a Bottom Border to Each Row in an HTML Table?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template