选中复选框后如何更改样式文本

时间:2014-02-10 14:52:12

标签: html css styles checked

我想改变

中文字的样式

<input type="checkbox" /> Origano

在用户选中框

后,使用样式text-decoration:line-through制作“Origano”

2 个答案:

答案 0 :(得分:1)

最近浏览器的一种方式;

.selection_checkbox:checked + .selection_label {
 text-decoration:line-through;
}

<input id="oregano" type="checkbox" class="selection_checkbox" /> 
<label for="oregano" class="selection_label">Oregano</label>

http://jsfiddle.net/alexk/NR2Rr/

答案 1 :(得分:-1)

您可以将其添加到您的css文件

input[type="checkbox"][checked]{text-decoration:line-through}
相关问题