码迷,mamicode.com
首页 > Web开发 > 详细

单选、上传按钮的简单修饰

时间:2016-06-12 20:27:49      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:

//html代码
<div class="operateWays">
     <label>
         <input type="radio" name="Sex">
         <span></span>
     </label>
     <label>
         <input type="radio" name="Sex" checked="checked">
         <span></span>
     </label>
</div>
//css代码
.operateWays label{
    line-height: 3rem;
    height: 3rem;
    margin-right: 5px;
    position: relative;
}
.operateWays label input[type=‘radio‘],.operateWays label span{
    width: 50px;
    height:3rem;
    margin-top:5px;
}
.operateWays label span{
    position: absolute;
    top: 0px;
    left: 0px;
    display: block;
    text-align: center;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    border-radius: 2px;
}
.operateWays label input[type=‘radio‘]{
    opacity: 0;
    filter: alpha(opacity=0);   
}
.operateWays label input[type=‘radio‘]:checked+span{
    background: #4A943D;
    border-color: #4A943D;
    color: #fff;                    
}
.operateWays label span:hover{
    cursor:pointer;
}

最终显示的效果:技术分享

//css代码
.fileinputBtn {
    height: 35px;
    position: relative;
    width: 80px;
    overflow: hidden;
}
input[type="file"] {
    position: absolute;
    top: 0px;
    left: 0px;
    font-size: 100px;
    opacity: 0;
    filter: alpha(opacity=0);
}
.btn-success{
   background-color: #3a9d5d;
    border-color: #3a9d5d;
   -webkit-appearance: push-button;
    white-space: nowrap;
    font-size: inherit;
    -webkit-user-modify: read-only;
    margin: 0px;
} //html代码
<div class="fileinput-button fileinputBtn btn btn-success"> <input type="file" name="AdPicture" data-upload-type="IMAGE" accept="image/*"> 上传文件
</div>

最终显示的效果是:技术分享

单选、上传按钮的简单修饰

标签:

原文地址:http://www.cnblogs.com/liuhui-03/p/5578531.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!