<div style="--size: 40vh"></div>
<div style="--size: 40vh 50%"></div>
<div class="no__size"></div>
<div class="no__size"></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;
display: grid;
grid-template-columns: repeat(2, 40vh 1fr);
padding: 10px 10px 30px;
gap: 30px 10px;
font-family: "Exo", Arial, sans-serif;
background-color: #222;
color: #fff;
place-content: center;
}
:root {
--color-start: #09f;
--color-end: rgba(255, 255, 255, 1);
--size: ;
}
div {
border-radius: 5px;
border: 1px solid #efefef;
min-height: 40vh;
position: relative;
background-image: radial-gradient(
var(--size),
var(--color-start),
var(--color-end)
);
}
.no__size {
background-image: radial-gradient(var(--color-start), var(--color-end));
}
div::after {
content: attr(style);
position: absolute;
top: calc(100% + 5px);
white-space: nowrap;
left: 50%;
transform: translate(-50%, 0);
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.