How to Make CSS Zig-Zag Border | Quick CSS Trick
HTML CODE:
<!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>zig-zag</title>
</head>
<body>
<div class=”box”></div>
</body>
</html>
CSS CODE:
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color:#f8f8f8;
}
.box
{
position: relative;
width: 300px;
height: 400px;
background: #62baea;
}
.box::before
{
content: ‘’;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 24px;
background: linear-gradient(-135deg,#f8f8f8 12px, transparent 0%),linear-gradient(135deg,#f8f8f8 12px, transparent 0%);
background-size: 24px;
}
.box::after
{
content: ‘’;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 24px;
background: linear-gradient(-45deg,#f8f8f8 12px, transparent 0%),linear-gradient(45deg,#f8f8f8 12px, transparent 0%);
background-size: 24px;
}
Thanks….