Skip to content

Instantly share code, notes, and snippets.

@xyproto
Created February 24, 2026 13:06
Show Gist options
  • Select an option

  • Save xyproto/369fbcf216193e993c2e5a8a21ab1164 to your computer and use it in GitHub Desktop.

Select an option

Save xyproto/369fbcf216193e993c2e5a8a21ab1164 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Background Mountains</title>
<style>
body {
background-color: #F7FFFF;
margin: 0;
}
.mountain {
position: fixed;
width: 62vw;
height: 62vw;
transform: rotate(45deg);
z-index: -1;
}
.mountain-blue { background: rgba( 73, 57, 255, 0.6); left: -16vw; bottom: -31vw; }
.mountain-green { background: rgba(121, 255, 94, 0.6); left: 5vw; bottom: -49vw; }
.mountain-red { background: rgba(255, 80, 53, 0.6); left: 25vw; bottom: -36vw; }
.mountain-yellow { background: rgba(255, 214, 67, 0.6); left: 45vw; bottom: -45vw; }
.mountain-purple { background: rgba(255, 26, 227, 0.6); left: 65vw; bottom: -40vw; }
@media (min-aspect-ratio: 1/2) {
.mountain-blue { left: 5vw; bottom: -49vw; }
.mountain-green { left: 25vw; bottom: -36vw; }
.mountain-red { left: 45vw; bottom: -45vw; }
.mountain-yellow { left: 65vw; bottom: -40vw; }
.mountain-purple { left: -16vw; bottom: -31vw; }
}
@media (min-aspect-ratio: 3/4) {
.mountain-blue { left: 25vw; bottom: -36vw; }
.mountain-green { left: 45vw; bottom: -45vw; }
.mountain-red { left: 65vw; bottom: -40vw; }
.mountain-yellow { left: -16vw; bottom: -31vw; }
.mountain-purple { left: 5vw; bottom: -49vw; }
}
@media (min-aspect-ratio: 1/1) {
.mountain-blue { left: 45vw; bottom: -45vw; }
.mountain-green { left: 65vw; bottom: -40vw; }
.mountain-red { left: -16vw; bottom: -31vw; }
.mountain-yellow { left: 5vw; bottom: -49vw; }
.mountain-purple { left: 25vw; bottom: -36vw; }
}
@media (min-aspect-ratio: 4/3) {
.mountain-blue { left: 65vw; bottom: -40vw; }
.mountain-green { left: -16vw; bottom: -31vw; }
.mountain-red { left: 5vw; bottom: -49vw; }
.mountain-yellow { left: 25vw; bottom: -36vw; }
.mountain-purple { left: 45vw; bottom: -45vw; }
}
@media (min-aspect-ratio: 16/9) {
.mountain-blue { left: 65vw; bottom: -40vw; }
.mountain-green { left: 45vw; bottom: -45vw; }
.mountain-red { left: 25vw; bottom: -36vw; }
.mountain-yellow { left: 5vw; bottom: -49vw; }
.mountain-purple { left: -16vw; bottom: -31vw; }
}
</style>
</head>
<body>
<div class="mountain mountain-blue"></div>
<div class="mountain mountain-green"></div>
<div class="mountain mountain-red"></div>
<div class="mountain mountain-yellow"></div>
<div class="mountain mountain-purple"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment