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

首頁(yè) > 開(kāi)發(fā) > CSS > 正文

CSS偽元素 :before, :after, box-shadow應(yīng)用

2024-07-11 08:37:36
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

利用CSS偽元素 :before 和 :after 可以在文檔前后插入內(nèi)容而不改變文檔原有結(jié)構(gòu),再配合 box-shadow 可以實(shí)現(xiàn)很炫的效果,

下面就展示三個(gè)例子:

1、利用 :before 和 :after 添加背景,比如給一段文字前后打引號(hào);

2、利用 :before, :after, box-shadow 實(shí)現(xiàn)3D陰影效果;

3、利用 :before, :after, box-shadow 實(shí)現(xiàn)照片疊加效果.


<!DOCTYPE html>
<html lang=”zh-cn”>
<head>
<title>Pseudo Demo</title>
<style>
body{background-color:#ccd3d7;padding:40px;}
h2{display:block;border-bottom:1px solid #ddd;padding:15px;}
p.myquote{padding:1em;font-size:16px;margin:8px 1em;position:relative;color:blue;line-height:1.7em;}
p.myquote:before,p.myquote:after{font-size:40px;position:absolute;padding:0;margin:0;color:green;}
p.myquote:hover:before,p.myquote:hover:after{color:red;font-size:50px;}
p.myquote:before{content:”“”;left:0;left:-10px;}
p.myquote:after{content:”””;padding-left:15px;bottom:4px;}
.shbox{
background:#fff;
padding:10px;
width:90%;
margin:40px auto;
height:auto;
margin:40px auto;
}
.sh-down-lr{position:relative;}
.sh-down-lr:before,.sh-down-lr:after{
z-index: -1;
position: absolute;
content: “”;
bottom: 15px;
left: 10px;
width: 50%;
top: 80%;
max-width:300px;
background: #777;
-webkit-box-shadow: 0 15px 10px #777;
-moz-box-shadow: 0 15px 10px #777;
box-shadow: 0 15px 10px #777;
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
-ms-transform: rotate(-3deg);
transform: rotate(-3deg);
}
.sh-down-lr:after{
-webkit-transform: rotate(3deg);
-moz-transform: rotate(3deg);
-o-transform: rotate(3deg);
-ms-transform: rotate(3deg);
transform: rotate(3deg);
right:10px;
left:auto;
}
.stackone {
border: 6px solid #fff;
width: 400px;
height:225px;
margin: 50px;
position: relative;
-webkit-box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
-moz-box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}
.stackone img{width:100%;heigth:100%;}
.stackone:before,.stackone:after {
content: “”;
width: 400px;
height:225px;
background: #aaa;
border: 6px solid #fff;
position:absolute;
z-index:-1;
top:0;
left:-10px;
-webkit-box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
-moz-box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
-webkit-transform: rotate(-5deg);
-moz-transform: rotate(-5deg);
-o-transform: rotate(-5deg);
-ms-transform: rotate(-5deg);
transform: rotate(-5deg);
}
.stackone:after {

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 华亭县| 舞阳县| 万荣县| 调兵山市| 常德市| 兴义市| 甘肃省| 镇康县| 郎溪县| 河西区| 南华县| 阳西县| 柘荣县| 葵青区| 屯门区| 蓝山县| 弋阳县| 鄂伦春自治旗| 金坛市| 舟山市| 房产| 濮阳县| 报价| 循化| 台江县| 公主岭市| 屯门区| 南投县| 萨迦县| 清远市| 象山县| 定远县| 诏安县| 睢宁县| 安龙县| 喀什市| 南漳县| 曲阳县| 平顶山市| 布尔津县| 霞浦县|