如何使用图像的复选框使用CSS或可能是Javascript? [英] How to use images for check boxes using CSS or may be Javascript?

查看:141
本文介绍了如何使用图像的复选框使用CSS或可能是Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这显然是很简单的问题,但我从来没有这样做过。我的设计师想要一些像这个(它在左侧,选中的是灰色和其他白色)复选框。任何帮助,将不胜感激。

It is obviously very simple question but I have never done such thing before. My designer want some thing like this (it is on left side. Checked ones are grey and other white) for check boxes. Any help regarding this will be appreciated.

推荐答案

一个想法是使用带有背景图像的空格(空框),隐藏相关复选框,到相应的隐藏复选框的onclick:change checked属性,相应地改变跨度的背景图像)。

One idea is to use a span with background-image (empty box), hide a related checkbox, and assign a clickhandler to the the span (onclick: change checked attribute of the related hidden checkbox, change background image of the span accordingly).

这里是

Here is an example of that

这篇关于如何使用图像的复选框使用CSS或可能是Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆