HTML Element Style How to - Add dotted border in adjacent columns in a table








Question

We would like to know how to add dotted border in adjacent columns in a table.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
table {<!--from  w w w. ja  v  a  2  s . c  o m-->
  border-collapse: separate;
  border-spacing: 2px 0;
}

td {
  border-bottom: #1C9AD5 dotted 2px;
}

#test2 {
  width: 30px;
}

#test3 {
  width: 30px;
}

#test4 {
  width: 30px;
}

#test5 {
  width: 30px;
}

#test6 {
  width: 30px;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td id="test2">test</td>
      <td id="test3">test</td>
    </tr>
    <tr>
      <td id="test4">test</td>
      <td id="test5">test</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: