html
<!-- 半透明遮罩层 --> <div class="mask" style="display: none;"></div>
css
.mask{ position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 100; display: none; }
jQuery
$('.mask').fadeIn(); //淡入展示
$('.mask').fadeOut(); //淡出消失
定位
.wechat_header{ margin-top: 30px; position:relative; } .wechat_header .wechat_close{ position: absolute; top: 0; right: 0; }
wechat_close相对于wechat_header定位
原文链接:CSS半透明遮罩层 and 定位
个人博客:www.liusongs.com