HTML Element Style How to - Make outer border of table to be of a colour different from inner








Question

We would like to know how to make outer border of table to be of a colour different from inner.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
table {<!--  ww w .  j  a  v  a  2 s  .  com-->
  border: 5px solid green;
}

table td {
  border: 3px solid red;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td>Header</td>
      <td>Data</td>
      <td>Header</td>
      <td>Data</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: