純css3點擊切換圖片-純css3點擊切換圖標

一:純css3點擊切換-----圖片(利用類選擇器,input的單選,單擊後沒顯示css


.check-box input{position: absolute; opacity: 0; filter: alpha(opacity=0);}
.check-box input+span{position: relative; display: inline-block; margin-right: 5px; width: 16px; height: 16px; background-position: -78px -38px; vertical-align: top;}
.check-box input+span:after{position: absolute; top: 0; right: 0; bottom: 0; left: 0; font-family: "FontAwesome"; font-size: 10px; color: #fff; line-height: 18px; content: " ";}
.check-box input:checked+span{background-position: -96px -38px;}
 html

css  

.touch-hflexbox {-webkit-box-orient: horizontal;}
.touch-hflexbox
{display:-webkit-box;-webkit-box-sizing:border-box;box-sizing: border-box;}
.cd-popup-trigger
{padding:1.8rem .5rem; background:#fff; -webkit-box-align:center;}
.payinfor
{width: 200px;padding:1.8rem .5rem; background:#fff;-webkit-box-align:center;}
.paysel{ margin:0 .5rem;}
.selectgood{}
.paysel input[type="radio"]{-webkit-appearance: none;outline: none; width:2.4rem;
 height:2.5rem; display: inline-block; background:url(../images/icon.png) no-repeat;
  background-size:20rem auto; background-position:-11rem -16.6rem;}
.paysel input[type="radio"]:checked
{background-position:-13.4rem -16.6rem;border: none}
.paysel input{outline:none;}

 

html
 
<div class="payinfor touch-hflexbox">
    <div class="space"></div>
    <div class="paysel">
        <input type="radio">
        微信支付</div>
    <div class="paysel">
        <input type="radio" class="cd-popup-trigger">
        到店自提</div>
</div>

 

 

純css3點擊切換-----圖片(利用類選擇器,input的單選,單擊先後都有變化css3

 

css

.selectgood{}
.selectgood input[type="checkbox"]{-webkit-appearance: none;outline: none; 
width:2.4rem; height:2.5rem; display: inline-block; 
background:url(../images/icon.png) no-repeat; background-size:20rem auto; 
background-position:-11rem -16.6rem;}
.selectgood input[type="checkbox"]:checked
{background-position:-13.4rem -16.6rem;border: none}
html

<div class="selectgood"><input type="checkbox"></div>

 

 

二:純css3點擊切換圖標(利用類選擇器,input的單選,單擊先後都有變化web

要先引用圖標字體微信

 

css

.xuan_ji_wan{width: 400px; position: relative;}
.xuan_ji_wan span.wan{text-align: right; position: absolute; right:0;}
.check_box{ position: relative;}
.check_box input[type="checkbox"]{ position: absolute; width:100px; height:20px;
line-height: 20px; opacity:0; z-index: 2;}
.check_box input[type="checkbox"]~i{ font-size:15px; color: #000;}
.check_box input[type="checkbox"]:checked~i.icon-uncheck:before{content: "\e605"; 
color:#e73d3e}
html

<div class="xuan_ji_wan">
    <span class="check_box">
        <input type="checkbox" name="checkAll" class="checkboxall">
        <i class="icon-uncheck"></i>
        <a href="#">記住登陸名</a>
    </span>
</div>

 

//有誤的話麻煩聯繫指正、批評app

相關文章
相關標籤/搜索