简体   繁体   中英

how to change style text after checked a checkbox

I would like to change the style of the text inside the

<input type="checkbox" /> Origano

to make "Origano" with style text-decoration:line-through after an user checked the box

One way in recent browsers;

.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/

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM