Home > Web Front-end > CSS Tutorial > Why Doesn't My Table Row Bottom Border Appear Using CSS?

Why Doesn't My Table Row Bottom Border Appear Using CSS?

Linda Hamilton
Release: 2024-12-10 19:46:09
Original
250 people have browsed it

Why Doesn't My Table Row Bottom Border Appear Using CSS?

How to Add Borders to the Bottom of Table Rows

You have a 3x3 table and you want to add a border to the bottom of each row. You tried adding the style attribute directly to the elements, but that didn't work. You then added CSS like this:

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

But that still didn't work. You prefer to use CSS, so you don't need to add a style attribute to every row.

The problem is that you haven't added border-collapse:collapse to your table rule. This property tells the browser to collapse the borders of adjacent cells. Without it, the borders will be drawn on top of each other, making it difficult to see the lines.

To fix the issue, add border-collapse:collapse to your table rule:

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

Here is an example:

table {
border-collapse: collapse;
}

tr {
border-bottom: 1pt solid black;
}
Copy after login
<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

This will add a 1pt black border to the bottom of each row in your table.

The above is the detailed content of Why Doesn't My Table Row Bottom Border Appear Using CSS?. 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