CSS Radial Gradient for Wavy Border
12/17/2020
Demo
Code
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>CSS Radial Gradient for Wavy Border</title>
<link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
<link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container">
<div class="wavy-border">
<h1>Pure CSS<br>Wavy Border</h1>
</div>
</div>
</body>
</html>
CSS
@charset "utf-8";
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 16px;
}
body {
font-family: futura-pt, sans-serif;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
display: flex;
align-items: flex-end;
width: 100%;
height: 100vh;
}
.wavy-border {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 100%;
background-color: #00aae3;
}
.wavy-border::before {
position: absolute;
top: 24px;
right: 0;
left: 0;
height: 50px;
background-image: radial-gradient(
closest-side,
#fff,
#fff 50%,
transparent 50%
);
background-position: 0 -25px;
background-size: 50px 50px;
background-repeat: repeat-x;
content: '';
}
.wavy-border::after {
position: absolute;
top: -25px;
right: 0;
left: 0;
height: 50px;
background-image: radial-gradient(
closest-side,
transparent,
transparent 50%,
#fff 50%
);
background-position: -25px 25px;
background-size: 50px 50px;
background-repeat: repeat-x;
content: '';
}
h1 {
margin: 0;
color: #fff;
font-size: 4.75rem;
text-align: center;
}
@media screen and (max-width: 480px) {
h1 {
font-size: 2.5rem;
}
}