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 add internal lines to a HTML table?

This is how my current table looks like:
enter image description here

I would prefer the table has no border but contains internal lines. That means there should only be 8 horizontal lines. How do I achieve this?

Here are my codes:

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

<table class="table">
  <?php
      $file = fopen("Book1.csv","r");
      $data = array();
      while($row = fgetcsv($file)) {
      $data[] = $row; //Get all the data 
      }
      if($data){
          $n_columns = count($data[0]); //Get number of columns 
      }
      echo '<table border="0">'; 
      for ($col = 0; $col < $n_columns; $col++) {
          echo '<tr>';
          foreach ($data as $row_k => $row) {
              if ($row_k == 0) {
                  echo '<th>';
              } else {
                  echo '<td>';
              }

              echo $row[$col] ?? '';
              if ($row_k == 0) {
                  echo '</th>';
              } else {
                  echo '</td>';
              }
          }
          echo '</tr>';
      }
      echo '</table>';
  ?>
</table>  

<style type="text/css">
  table{
    border-color: #17a2b8;
  }
</style>

>Solution :

Try this:

table {
    border-collapse: collapse;
    width: 100%;
}

tr {
    border-bottom: 1px solid #17a2b8;
}
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