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

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

Mary-Kate Olsen
Release: 2024-12-17 16:58:17
Original
430 people have browsed it

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

Adding Border to Table Rows

When working with HTML tables, you may encounter the need to add a border to the bottom of each row. However, attempting to do so using inline styles or direct CSS rules can prove ineffective.

To achieve this desired effect, it is crucial to incorporate the border-collapse: collapse attribute into your CSS. This attribute collapses the shared borders between adjacent cells, resulting in a cleaner and more structured table layout. By applying this attribute to the table rule, the CSS rule for the bottom border will take effect as intended.

Example:

table {
  border-collapse: collapse;
}

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

This will ensure that every row in the table has a black solid border at the bottom, enhancing the visual appeal and organization of your tabular data.

The above is the detailed content of How Can I Add a Bottom Border to Each Row of 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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template