Technicalarticles
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Floating Box</title> </head> <body> <h1>GeeksForGeeks</h1> <div class="geeks"></div> </body> </html>
第1步:首先,我们完成了一些基本的样式设置,例如设置背景,创建外框并将所有内容对齐页面中心。
步骤2:现在,使用After选择器在我们创建的框下方创建一条细线,然后使用blur函数为其赋予阴影效果。
<style>
body {
background: green;
}
h1 {
display: flex;
justify-content: center;
color: white;
font-size: 40px;
}
.geeks {
width: 400px;
height: 250px;
background: white;
position: absolute;
top: 16%;
left: 35%;
border-radius: 20px;
}
.geeks::after {
content: "";
position: absolute;
bottom: -30px;
background: rgb(43, 42, 42);
width: 90%;
height: 4px;
left: 3%;
border-radius: 50%;
filter: blur(3px);
}
</style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=
"width=device-width,initial-scale=1.0">
<title>Floating Box</title>
<style>
body {
background: green;
}
h1 {
display:flex;
justify-content: center;
color: white;
font-size: 40px;
}
.geeks {
width:400px;
height:250px;
background: white;
position: absolute;
top:16%;
left:35%;
border-radius: 20px;
}
.geeks::after {
content: "";
position: absolute;
bottom: -30px;
background: rgb(43, 42, 42);
width: 90%;
height:4px;
left:3%;
border-radius:50%;
filter: blur(3px);
}
</style>
</head>
<body>
<h1>GeeksForGeeks</h1>
<div class="geeks"></div>
</body>
</html>
DO U LIKE?