html代码:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发光的拐角|CSS技巧</title>
<link rel="stylesheet" href="style.css">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发光的拐角|CSS技巧</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box"></div>
<div class="box"></div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发光的拐角|CSS技巧</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box"></div>
<div class="box"></div>
</body>
</html>
css代码:
background:linear-gradient(45deg,#00ccff,#0e15
box-shadow: 0 0 0 20px #370c23;
background:linear-gradient(45deg,#00ccff,#0e15
.box:nth-child(2):before,
background:linear-gradient(45deg,#ffeb3b,#0e15
*
{
margin:0;
padding:0;
box-sizing: border-box;
}
body
{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background:#0e1538;
gap:200px;
}
.box
{
position:relative;
width:300px;
height:400px;
background:#0e1538;
}
.box::before
{
content:'';
position:absolute;
inset:-3px;
background:linear-gradient(45deg,#00ccff,#0e15
,#0e1538,#d400de);
box-shadow: 0 0 0 20px #370c23;
z-index:-1;
}
.box::after
{
content:'';
position:absolute;
inset:-3px;
background:linear-gradient(45deg,#00ccff,#0e15
,#0e1538,#d400de);
z-index:-1;
filter:blur(20px);
}
.box:nth-child(2):before,
.box:nth-child(2)::after
{
background:linear-gradient(45deg,#ffeb3b,#0e15
,#0e1538,#00ff0a);
}
*
{
margin:0;
padding:0;
box-sizing: border-box;
}
body
{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background:#0e1538;
gap:200px;
}
.box
{
position:relative;
width:300px;
height:400px;
background:#0e1538;
}
.box::before
{
content:'';
position:absolute;
inset:-3px;
background:linear-gradient(45deg,#00ccff,#0e15
,#0e1538,#d400de);
box-shadow: 0 0 0 20px #370c23;
z-index:-1;
}
.box::after
{
content:'';
position:absolute;
inset:-3px;
background:linear-gradient(45deg,#00ccff,#0e15
,#0e1538,#d400de);
z-index:-1;
filter:blur(20px);
}
.box:nth-child(2):before,
.box:nth-child(2)::after
{
background:linear-gradient(45deg,#ffeb3b,#0e15
,#0e1538,#00ff0a);
}