1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 单选按钮 多选按钮用图片实现加样式【HTML】

单选按钮 多选按钮用图片实现加样式【HTML】

时间:2019-04-01 14:53:45

相关推荐

单选按钮 多选按钮用图片实现加样式【HTML】

web前端|html教程

单选按钮,多选按钮

web前端-html教程

之前一直看到有人在问,单选按钮和多选按钮怎么加样式、怎么把按钮变大?下面把我做的一个例子分享出来。

php餐厅官网源码,ubuntu查看内存参数,tomcat最大线程配置,爬虫技术接口,php字体下载,大渡口区seo优化市场价格lzw

1.首先把按钮做成图片

马克思源码手机版,ubuntu程序闪退,头上爬虫啥寓意,php truck,youtube学习seolzw

2.html页面

游戏假人源码,如何开启ubuntu远程,Tomcat服务器加载很慢,spider 爬虫平台,php网站程序源码下载,seo冬镜lzw

复制代码代码如下:

$(function(){

$(“input[type=’checkbox’]”).click(function(){

if($(this).is(‘:checked’)){

$(this).attr(“checked”,”checked”);

$(this).parent().removeClass(“c_off”).addClass(“c_on”);

}else{

$(this).removeAttr(“checked”);

$(this).parent().removeClass(“c_on”).addClass(” c_off”);

}

});

$(“input[type=’radio’]”).click(function(){

$(“input[type=’radio’]”).removeAttr(“checked”);

$(this).attr(“checked”,”checked”);

$(this).parent().removeClass(“r_off”).addClass(“r_on”).siblings().removeClass(“r_on”).addClass(“r_off”);

});

});

/* 多选/单选 */

label {

display: block;

cursor: pointer;

line-height: 26px;

margin-bottom: 20px;

width: 26px;

height: 26px;

line-height: 26px;

float: left;

margin-top: 6px;

}

.radios {

padding-top: 18px;

border-top: 1px solid #049CDB;

}

.label_check input, .label_radio input {

margin-right: 5px;

}

.lblby .label_check, .lblby .label_radio {

margin-right: 8px;

}

.lblby .label_radio, .lblby .label_check {

background: url(../images/jxc_btn.jpg) no-repeat;

}

.lblby .label_check {

background-position: 0 0px

}

.lblby label.c_on {

background-position: 0 -26px;

}

.lblby .label_radio {

background-position: 0 -52px;

}

.lblby label.r_on {

background-position: 0 -78px;

}

.lblby .label_check input, .lblby .label_radio input {

position: absolute;

left: -9999px;

}

Checkbox1

Checkbox2

Radio1

Radio2

Radio3

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。