单选框,复选框美化(纯css)

单选框,复选框美化

废话不多说先上图

接着是代码

index.html

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" name="viewport" />

<style type="text/css">
body {
	font: 14px/150% microsoft yahei,tahoma;
	}
.clear {
	clear: both
	}
.RadioStyle input {
	display: none
	}
.RadioStyle label {
	border: 1px solid #00a4ff;
	padding: 2px 10px 2px 5px;
	line-height: 28px;
	min-width: 80px;
	text-align: center;
	float: left;
	margin: 2px;
	border-radius: 4px
	}
.RadioStyle input:checked + label {
	background: url(images/ico_checkon.svg) no-repeat right bottom;
	background-size: 21px 21px;
	color: #00a4ff
	}
</style>

<title>纯CSS 单/复选框 美化</title>
</head>
<body>

单选框

<div class="RadioStyle">
    <div class="Block PaddingL">
        <input type="radio" name="Storage" id="model1" />
        <label for="model1">单选框A</label>
        <input type="radio" name="Storage" id="model2" />
        <label for="model2">单选框B</label>
        <input type="radio" name="Storage" id="model3" />
        <label for="model3">单选框C</label>
        <input type="radio" name="Storage" id="model4" checked />
        <label for="model4">单选框D</label>
    </div>
</div>

<div class="clear"></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
多选框

<div class="RadioStyle">
    <div class="Block PaddingL">
        <input type="checkbox" id="love1" />
        <label for="love1">多选框1</label>
        <input type="checkbox" id="love2" />
        <label for="love2">多选框2</label>
        <input type="checkbox" id="love3" />
        <label for="love3">多选框3</label>
        <input type="checkbox" id="love4" checked />
        <label for="love4">多选框4</label>
    </div>
</div>

<div class="clear"></div>
</body>
</html>
svg图
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="ico_checkon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
	 y="0px" viewBox="0 0 42 42" style="enable-background:new 0 0 42 42;" xml:space="preserve">
<style type="text/css">
	.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#00A4FF;}
	.st1{fill:#FFFFFF;}
</style>
<g>
	<g>
		<polygon class="st0" points="42,42 42,0.5 0.5,42 		"/>
	</g>
</g>
<path class="st1" d="M19.4,26.9l8.5,8.5L25,38.2l-8.5-8.5L19.4,26.9z M36.4,21.2l2.8,2.8L25.1,38.2l-2.8-2.8L36.4,21.2z"/>
</svg>

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值