Striped Background with CSS repeating-linear-gradient
01/31/2021
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 Striped Background</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">
<h1>CSS Striped Background</h1>
</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;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 100vh;
padding: 15px;
background-image: repeating-linear-gradient(-45deg, #c998ea 0, #c998ea 10px, #fff 10px, #fff 20px);
}
h1 {
margin: 0;
padding: 15px 10px;
background-color: #fff;
color: #3d3935;
font-size: 2.5rem;
text-align: center;
}
@media screen and (max-width: 480px) {
h1 {
font-size: 1.75rem;
}
}