I'm trying to make a single cell (referred to as 1A) in this table have a separate background color by overriding the CSS. I've tried using !important
as well, but I just can't get the background color to show up at all. It works when I use functions to change it in JavaScript, but not when I try to directly target it in CSS.
p {
background-color: white;
max-width: 100%;
height: 100%;
display: table-cell;
border: 10px solid pink;
padding: 50px;
text-align: center;
}
#1A {
background-color: red;
}
Also, I'm using addEventListener("keydown")
to listen to character keystrokes "b", "o", and "y" to change the background colors of cells in JavaScript. Is "keydown" recommended for this? Why when I tried to use "keypress" did it not work?
Full code: https://codepen.io/Lukedoc321/pen/powRRMW?editors=1111