Styling

We can also add visual interest to tables to help with easier reading and showcasing of data. We do this with the style element.

Remember? Last topic, we looked at adding style to HTML in the document’s <head>, via the <style>...</style> element.

We can reference the individual elements of the table as a group for easier styling. We do this by separating the elements by commas in the same line of code. Everything in this string will be affected by the styling described between {}.

NOTE: Ideally, this is something you’ll do in a stylesheet when we get to CSS.

HTML
<head>
  <style>
      table, th, td {
        /* Attributes that will "decorate" the table: */
      }
  </style>
</head>

<body>
  <table>
    <!-- Table contents to-be-styled: -->
  </table>
</body>