Onur Aydoğdu Onur Aydoğdu - 4 months ago 12
CSS Question

I can't change table background color

I started to learn HTML5 and CSS yesterday.Today, I am learning creating table and change it's background color.I tried to change it with CSS but i couldn't.How can i make it with CSS3?

Answer

you should use background-color in CSS file:

table {
    background-color: #00bd72;
}

or inside html tag

<table style="background-color: #00bd72">
...
</table>

check this snippet I just made for you ;) Good luck learning CSS

<html>
  <body>
    <h1>sample table</h1>
    <table style="background-color: #00bd72">
      <tr>
        <td>this is one cell</td>
        <td>this is another cell</td>
      </tr>
      <tr>
        <td>this is the second row</td>
        <td>blah blah ...</td>
      </tr>
    </table>
  </body>
</html>