标签:
之前在一个项目中需要定制checkbox,于是呼用图片模拟了一下,之后发现个更好用的方法(*因为兼容问题 在移动开发中用用就好)
效果:
实现代码:
<style type="text/css"> * { padding:0; margin:0;} #text { width:260px; margin:0 0 0 20px; padding:6px; border:4px solid #FC9; font-size:12px; color:white;} #text label { display:inline-block; margin:0 10px 0 0;} #text span { display:inline-block; cursor:pointer; width:24px; line-height:24px; border-radius:15px; text-align:center; background:#ccc;} #text input { display:none;} #text label input:checked + span { background:#F96;} </style>
<div id="text"> <label> <input type="radio" value="1" name="muber" /> <span>1</span> </label> <label> <input type="radio" value="2" name="muber" /> <span>2</span> </label> <label> <input type="radio" value="3" name="muber" /> <span>3</span> </label> <label> <input type="radio" value="4" name="muber" /> <span>4</span> </label> <label> <input type="radio" value="5" name="muber" /> <span>5</span> </label> <label> <input type="radio" value="6" name="muber" /> <span>6</span> </label> <label> <input type="radio" value="7" name="muber" /> <span>7</span> </label> </div>
标签:
原文地址:http://www.cnblogs.com/lilixing/p/4612919.html