HTML Element Style How to - Set a predefined text content for a table cell








Question

We would like to know how to set a predefined text content for a table cell.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td.orange:before {<!--from w ww . j ava2 s  .com-->
  background: #DD5F15;
  content: "TRIPLE";
}
</style>
</head>
<body>
  <table>
    <tr>
      <td>First Col</td>
      <td class="orange"></td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: