Hi, I use this kind of css to manage the appearance of my input radio button state :
input ~ div {
background-color: #4a4a4a;
padding: 8px;
font-weight: 400;
height: 100%;
width: 100%;
}
input:checked ~ div {
background-color: #363636;
padding: 8px;
font-weight: 400;
height: 100%;
width: 100%;
}
It works perfectly but when I reload the page, the css rule input:checked ~ div still apply to the last checked while it is no longer checked in the DOM…
for exemple I have 3 buttons :
- not checked
- not checked
- I checked this one, the rule input:checked ~ div is applied
If I reload the page :
- checked, return to default, works as designed, but the rule input:checked ~ div is not applied
- not checked
- not checked, but the rule input:checked ~ div is still applied
Moreover, the third button cannot be clicked again, despite in the DOM it is the first button that have the attribute checked=“checked” after page reloading
I don’t have this problem on other browsers (Safari or Chrome) only with Firefox, I have this version : 94.0.2 (64 bits) for Mac
Has anyone ever experienced this problem ?
Thanks for your help