Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to enlage a border between two rows of a table in HTML?

I’m trying to develop a message box in HTML with the following code:

table {
  border: 1px solid;
  border-color: lightgray;
  border-width: 1px;
  border-radius: 8px;
  padding: 10px;
}

.table_header {
  border-bottom: 1px solid;
  border-color: lightgray;
  border-width: 1px;
}
<table>
  <tr>
    <td class="table_header">Title</td>
  </tr>
  <tr>
    <td>Example message</td>
  </tr>
</table>

The border (line) between the Title and the Example message should contact the border of the table. How can I do this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Remove the padding and border-spacing on the table, and add padding to the cells:

table {
  border: 1px solid;
  border-color: lightgray;
  border-width: 1px;
  border-radius: 8px;
  border-spacing: 0;
}

.table_header {
  border-bottom: 1px solid;
  border-color: lightgray;
  border-width: 1px;
}

td {
  padding: 10px;
}
<table>
  <tr>
    <td class="table_header">Title</td>
  </tr>
  <tr>
    <td>Example message</td>
  </tr>
</table>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading