I am trying to add strikethrough when i select a checkbox in my form (Bootstrap v3). I coded this bootply:
The
:checkedCSS pseudo-class selector represents any radio (), checkbox () or option (in a) element that is checked or toggled to an on state. The user can change this state by clicking on the element, or selecting a different value, in which case the :checked pseudo-class no longer applies to this element, but will to the relevant one.
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/%3Achecked
In order to make it work, rearrange your HTML to:
And your CSS to:
.strikethrough:checked + label {
text-decoration:line-through
}
DEMO.