I currently have a checkbox. I want to implement a method as described below~
When the user clicks on the checkbox and it turns into a red background state, this action can be stored in a cookie using javascript. When the web page is refreshed, the red background state is still Exist, how can I write it to achieve it?
label input {
  display: none;
}
label i {
  display: block;
  width: 10px;
  height: 10px;
  border: 1px solid;
  background: red;
}
label input:checked ~ i {
  display: block;
  background-image: url("https://img.magiclen.org/albums/webpage-icon-font/shut-003.png");
  background-size: cover;
}<label>
  <input type="checkbox">
  <i></i>
</label> 
    