Created
July 15, 2021 03:19
-
-
Save djsubstance/3d1c431fe60373e53c8323ec4b38918e to your computer and use it in GitHub Desktop.
wvdJMNB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav>Global navigation</nav> | |
<header> | |
<h1>Fun with background gradients</h1> | |
<p>Just a bit of fun while wondering about using simple and subtle CSS gradients for backgrounds...</p> | |
</header> | |
<main> | |
<ul class="cards"> | |
<li class="card -red"> | |
<div class="card--image">✤</div><h2>Red</h2> | |
<p>Red is the color at the long wavelength end of the visible spectrum of light, next to orange and opposite violet.</p> | |
</li> | |
<li class="card -green"> | |
<div class="card--image">✦</div> | |
<h2>Green</h2> | |
<p>Green is the color between blue and yellow on the visible spectrum. It is evoked by light which has a dominant wavelength of roughly 495–570 nm.</p> | |
</li> | |
<li class="card -blue"> | |
<div class="card--image">❖</div> | |
<h2>Blue</h2> | |
<p>Blue is one of the three primary colours of pigments in painting and traditional colour theory, as well as in the RGB colour model. It lies between violet and green on the spectrum of visible light.</p> | |
</li> | |
</ul> | |
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
width: 100vw; | |
height: 200vh; | |
padding: 1rem; | |
font: { | |
family: | |
Avenir, | |
sans-serif; | |
size: 112.5%; | |
} | |
color: #124919; | |
background: { | |
image: | |
radial-gradient(rgba(red, 0.3), rgba(red, 0) 40vw), | |
radial-gradient(rgba(green, 0.3), rgba(green, 0) 40vw), | |
radial-gradient(rgba(blue, 0.3), rgba(blue, 0) 40vw), | |
radial-gradient(rgba(yellow, 0.3), rgba(yellow, 0) 40vw), | |
radial-gradient(rgba(red, 0.3), rgba(red, 0) 40vw); | |
position: | |
-40vw 14rem, | |
50% 10rem, | |
60vw 14rem, | |
-10vw calc(14rem + 20vw), | |
30vw calc(14rem + 20vw); | |
size: 60vw 80vw; | |
repeat: no-repeat; | |
} | |
} | |
nav { | |
position: fixed; | |
top: 0; | |
right: 0; | |
left: 0; | |
padding: 1.5rem 1rem; | |
background-color: white; | |
border-top: 4px solid mix(purple, white); | |
} | |
header { | |
max-width: 600px; | |
margin: 24vh auto; | |
} | |
h1 { | |
font: { | |
size: 3.2rem; | |
weight: 900; | |
} | |
line-height: 1.1; | |
+ p { | |
margin-top: 1rem; | |
} | |
} | |
main { | |
max-width: 800px; | |
margin: { | |
right: auto; | |
left: auto; | |
} | |
} | |
.cards { | |
display: flex; | |
flex-direction: column; | |
margin: -1rem; | |
list-style: none; | |
@media (min-width: 600px) { | |
flex-direction: row; | |
} | |
} | |
.card { | |
flex: 1; | |
margin: 1rem; | |
padding: 1rem; | |
background-color: white; | |
border-radius: 0.5rem; | |
box-shadow: 0 0 6rem rgba(black, 0.1); | |
* { | |
margin-bottom: 1rem; | |
} | |
} | |
.card--image { | |
font-size: 6rem; | |
line-height: 1; | |
.card.-red & { color: mix(red, white); } | |
.card.-green & { color: mix(green, white); } | |
.card.-blue & { color: mix(blue, white); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment