html - Why am I able to change the border color and thickness of my table' <thead> , but not the background color? -
i able change border styling of top bar in table, can't change background color no matter do. can tell me going wrong? code below:
<table> <thead> <tr > <th>strong>colour</strong></th> <th><strong>red</strong></th> <th><strong>green</strong></th> <th><strong>white</strong></th> </tr> </thead> <tbody> <tr> <td align="left">length (m)</td> <td>1</td> <td>0.5</td> <td>0.5</td> </tr> <tr> <td align="left">weight (kg)</td> <td>4</td> <td>2</td> <td>2</td> </tr> <tr> <td align="left">burn time (sec)</td> <td>60</td> <td>22</td> <td>15</td> </tr> <tr> <td align="left">light output (cd)</td> <td>200 000</td> <td>100 000</td> <td>850 000</td> </tr> <tr> <td align="left">visibility @ sea level (km)</td> <td>20</td> <td>15</td> <td>26</td> </tr> </tbody> css:
table th, table td { border: 1px solid gray; } table thead td, table thead tr { background-color: pink; border: 4px solid pink; }
your html code has syntax erros:
corrected here , working well:
<html> <head> <link rel="stylesheet" href="style.css"> <script src="script.js"></script> </head> <body> <table> <thead> <tr > <th><strong>colour</strong></th> <th><strong>red</strong></th> <th><strong>green</strong></th> <th><strong>white</strong></th> </tr> </thead> <tbody> <tr> <td align="left">length (m)</td> <td>1</td> <td>0.5</td> <td>0.5</td> </tr> <tr> <td align="left">weight (kg)</td> <td>4</td> <td>2</td> <td>2</td> </tr> <tr> <td align="left">burn time (sec)</td> <td>60</td> <td>22</td> <td>15</td> </tr> <tr> <td align="left">light output (cd)</td> <td>200 000</td> <td>100 000</td> <td>850 000</td> </tr> <tr> <td align="left">visibility @ sea level (km)</td> <td>20</td> <td>15</td> <td>26</td> </tr> </tbody> </table> </html>
Comments
Post a Comment