CSS "background-color" Attribute Not Working on Checkbox within When attempting to apply a background color to checkboxes contained within a scrolling This discrepancy arises because checkboxes natively lack the ability to display background color. To achieve the desired effect, wrap each checkbox within a Revised CSS Example: Revised HTML Example: By wrapping each checkbox in a The above is the detailed content of Why Isn\'t My Checkbox Background Color Changing Inside a Scrolling DIV?. For more information, please follow other related articles on the PHP Chinese website!.listContainer {
border: 2px solid #CCC;
width: 340px;
height: 225px;
overflow-y: scroll;
margin-top: 20px;
padding-left: 10px;
}
.oddRow,
.evenRow {
margin-top: 5px;
}
.oddRow {
border: 1px solid #333;
background-color: #FFFFFF;
}
.evenRow {
border: 1px solid #333;
background-color: #9FFF9D;
}
<div>