效果图:
css代码:
<style>
html {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
body {
padding: 50px;
background: hsla(0,0%,0%,.75);
}
.radiobox input {
-webkit-appearance: none;
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 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);
}
.radiobox input:checked {
-webkit-transition: background-position .2s .15s cubic-bezier(0, 0, .2, 1),
-webkit-transform .25s cubic-bezier(0, 0, .2, 1);
}
.radiobox input:active {
-webkit-transform: scale(1.5);
-webkit-transition: -webkit-transform .1s cubic-bezier(0, 0, .2, 1);
}
.radiobox input,
.radiobox input:active {
background-position: 0 24px;
}
.radiobox input:checked {
background-position: 0 0;
}
.radiobox input:checked ~ .radiobox input,
.radiobox input:checked ~ .radiobox input:active {
background-position: 0 -24px;
}
.content div {
margin: 10px 0;
color: #ffffff;
width: 80px;
height: 24px;
vertical-align: middle;
}
</style>
html部分:
<body>
<div class="radiobox" style="margin:30px auto;width:40px; float: left;">
<input type="radio" name="name" checked />
<input type="radio" name="name" />
<input type="radio" name="name" />
<input type="radio" name="name" />
</div>
<div class="content" style="margin:30px auto;float: right">
<div>苹果</div>
<div>香蕉</div>
<div>橘子</div>
<div>西瓜</div>
</div>
</body>