<div data-gradient-type="linear-gradient"></div>
<div data-gradient-type="repeating-linear-gradient"></div>
<div data-gradient-type="linear-gradient"></div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #222;
color: #fff;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 36px 10px;
padding: 10px 10px 36px;
font-size: 1.5rem;
}
div {
min-height: 30vh;
border-radius: 5px;
box-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
position: relative;
}
div::after {
content: attr(data-gradient-type) "()";
position: absolute;
left: 5px;
right: 5px;
top: calc(100% + 5px);
text-align: center;
font-size: 12px;
}
div:nth-of-type(1) {
background-image: linear-gradient(
45deg,
red 25%,
gold 25%,
gold 50%,
red 50%,
red 75%,
gold 0
);
background-size: 40px 40px;
}
div:nth-of-type(2) {
background-image: repeating-linear-gradient(
45deg,
red,
red 20px,
gold 20px,
gold 40px
);
}
div:nth-of-type(3) {
background-image: linear-gradient(
45deg,
red 25%,
gold 25%,
gold 50%,
red 50%,
red 75%,
gold 0
);
background-size: 56.5685px 56.5685px;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.