您的位置:首页 > Web前端 > CSS

基于CSS3自定义发光radiobox单选框

2015-04-11 08:54 519 查看
之前我们分享过一些CSS3和HTML5实现的自定义checkbox和Radiobox,比如纯CSS3美化Checkbox和Radiobox按钮,不仅外观唯美,而且Radiobox选中时还有动画效果。今天我们要来分享一款CSS3实现的自定义发光radiobox单选框插件,该radiobox选中时也有滑块的动画特效。



在线预览 源码下载

实现的代码。

html代码:

<style>
html
{
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
body
{
padding: 50px;
background-color: hsl(0,0%,20%);
}
input
{
-webkit-appearance: none; /* remove default */
display: block;
margin: 10px;
width: 24px;
height: 24px;
border-radius: 12px;
cursor: pointer;
vertical-align: middle;
box-shadow: hsla(0,0%,100%,.15) 0 1px 1px, inset hsla(0,0%,0%,.5) 0 0 0 1px;
background-color: hsla(0,0%,0%,.2);
background-image: -webkit-radial-gradient( hsla(200,100%,90%,1) 0%, hsla(200,100%,70%,1) 15%, hsla(200,100%,60%,.3) 28%, hsla(200,100%,30%,0) 70% );
background-repeat: no-repeat;
-webkit-transition: background-position .15s cubic-bezier(.8, 0, 1, 1), -webkit-transform .25s cubic-bezier(.8, 0, 1, 1);
}
input:checked
{
-webkit-transition: background-position .2s .15s cubic-bezier(0, 0, .2, 1), -webkit-transform .25s cubic-bezier(0, 0, .2, 1);
}
input:active
{
-webkit-transform: scale(1.5);
-webkit-transition: -webkit-transform .1s cubic-bezier(0, 0, .2, 1);
}
/* The up/down direction logic */input, input:active
{
background-position: 0 24px;
}
input:checked
{
background-position: 0 0;
}
input:checked ~ input, input:checked ~ input:active
{
background-position: 0 -24px;
}
</style>
<script src="js/prefixfree.min.js"></script>
</head>
<body>
<script src="/scripts/2bc/_gg_980_90.js" type="text/javascript"></script>
<div style="margin: 30px auto; width: 80px;">
<input type="radio" name="name" checked />
<input type="radio" name="name" />
<input type="radio" name="name" />
<input type="radio" name="name" />
<input type="radio" name="name" />
</div>
<script src="js/index.js"></script>
</body>


via:http://www.w2bc.com/Article/32018/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: