Add strikethrough to checked checkbox

后端 未结 6 1043
时光说笑
时光说笑 2021-02-13 23:57

I am trying to add strikethrough when i select a checkbox in my form (Bootstrap v3). I coded this bootply:

6条回答
  •  遇见更好的自我
    2021-02-14 00:16

    Here is a solution to put a strike through when your input is checked:

    input[type=checkbox]:checked + label.strikethrough{
      text-decoration: line-through;
    }

    JSFIDDLE

    With this solution when ever the checkbox is checked it will do something to the label. so you could make it bold or change its colour if you wanted.

提交回复
热议问题