我正在尝试为表格的第一行和第一列的每个单元格添加不同的背景颜色.
它应该是这样的:
我找到了一个选择器,可以为第一行的细胞应用不同的颜色,但现在我被第一列的细胞(早晨,下午和晚上)所困.我设法将它们全部变成蓝色,但每个都应该有不同的蓝色......).这是我的CSS代码:
table.agenda {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;}
table.agenda td, table.agenda th {
border: 1px solid #fff;
padding: 8px;
text-align: center;}
table.agenda td {
padding-top: 12px;
padding-bottom: 12px;
background-color: rgb(193, 212, 174);
color: black;}
th:nth-child(1) { background: white; }
th:nth-child(2) { background: rgb(72, 151, 54); color: white;}
th:nth-child(3) { background: rgb(84, 155, 64); color: white;}
th:nth-child(4) { background: rgb(97, 160, 73); color: white;}
th:nth-child(5) { background: rgb(110, 165, 82); color: white;}
th:nth-child(6) { …Run Code Online (Sandbox Code Playgroud)