国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

巧用CSS3 border實現(xiàn)圖片遮罩效果代碼

2024-07-11 08:36:35
字體:
供稿:網(wǎng)友


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>無標題文檔</title>
<style type=”text/css”>
.trans {
-webkit-transition: 0.3s ease;
-moz-transition: 0.3s ease;
-ms-transition: 0.3s ease;
-o-transition: 0.3s ease;
transition: 0.3s ease;
}
.test_outer {
display: block;
width: 200px;
height: 200px;
margin: 1em auto;
position: relative;
overflow: hidden;
}
.test_cover {
width: 40px;
height: 40px;
border: 200px solid rgba(0, 0, 0, .35);
border-radius: 50%;
position: absolute;
left: -115px;
top: -165px;
}
.test_cover:hover {
width: 140px;
height: 140px;
left: -170px;
top: -165px;
}
.test_cover:hover:after {
content: “秋思-一葉知秋!”;
text-align:center;
margin:55px 0 0 12px;
color: #fff;
font: bold 16px/1.2 ‘微軟雅黑’;
text-shadow: 1px 1px rgba(0, 0, 0, .35);
position: absolute;
}
</style>
</head>
<body>
<a href=”#” class=”test_outer”>
<span class=”test_cover trans”></span>
<img src=”http://img.Vevb.com/data/avatar/000/00/64/47_avatar_middle.jpg” width=”200″ height=”200″ />
</a>
</body>
</html>

其實現(xiàn)原理是利用個border偌大的半透明邊框?qū)傩裕╠emo中邊框?qū)挾?00像素),邊框顏色為rgba黑色半透明,然后50%圓角。再用用定位把它覆蓋在圖片上面。
主要核心代碼:


.test_cover {
width: 40px;
height: 40px;
border: 200px solid rgba(0, 0, 0, .35);
border-radius: 50%;
position: absolute;
left: -115px;
top: -165px;
}

然后外面再用個父容器把它溢出隱藏掉就可以了


.test_outer {
display: block;
width: 200px;
height: 200px;
margin: 1em auto;
position: relative;
overflow: hidden;
}

就這么簡單….

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 武平县| 阿坝| 八宿县| 正定县| 綦江县| 措勤县| 建宁县| 柘城县| 呈贡县| 延长县| 昌都县| 务川| 德庆县| 丹东市| 锦州市| 龙泉市| 邓州市| 睢宁县| 会宁县| 榆林市| 永吉县| 余江县| 十堰市| 古丈县| 专栏| 伊吾县| 闻喜县| 灌云县| 惠来县| 隆子县| 酒泉市| 贵德县| 长寿区| 武平县| 金昌市| 友谊县| 淮滨县| 安阳市| 达尔| 墨竹工卡县| 吉隆县|