css实现radio选中效果

html代码:

  

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>span-css模拟radio</title>
    <style type="text/css">
        #wrap{
            width: 500px;
            height: 500px;
            margin: 50px auto;
        }
        label input{
            display: none;        
        }
        label span{
            display: inline-block;
            width: 20px;
            height: 20px;
            background: url(../img/radio.png) no-repeat 0 0;
            background-position: -55px -5px;
        }
        label input:checked+span{
            background-position: -5px -5px;
        }
    </style>
</head>
<body>
    <div id="wrap">
        <label>
            <input type="radio" value="meal" name="sex">
            <span></span></label>
        <label>
            <input type="radio" value="femeal" name="sex">
            <span></span></label>        
    </div>
    
</body>
</html>

posted @ 2015-03-13 14:06  sdufewind  阅读(1450)  评论(0)    收藏  举报