css3 pointer-events:none 允许点击穿透 (实用)

原文出处:https://blog.csdn.net/xtaydwxf1988/article/details/70308149

pointer-events: none  这句是关键

<style>
    .container {    
	position: relative;    
	width: 200px;    
	height: 50px;    
	margin: 20px 0;
    }

    .cover_through {    
        pointer-events: none;  //使用当前属性点击div将触发链接
    }

    .cover {   
	position: absolute;    
	top: 0;    
	left: 0;    
	width: 100%;    
	height: 100%;    
	background-color: rgba(255,203,152,0.5);
    }
</style>


<div class="container">  
    <div class="cover_through cover js-click-to-alert"></div>  
    <a href="http://wx.huipinze.com" target="_blank">http://wx.huipinze.com</a>
</div>


 

猜你喜欢

转载自blog.csdn.net/chelen_jak/article/details/86081153
今日推荐