Skip to content

Instantly share code, notes, and snippets.

@celsojr
Created July 23, 2023 19:19
Show Gist options
  • Save celsojr/6488308583690492c6829caa45574200 to your computer and use it in GitHub Desktop.
Save celsojr/6488308583690492c6829caa45574200 to your computer and use it in GitHub Desktop.
Simple colored triangle with html and css only. Just for fun imitating the CG api triangles.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
body {
background-color: black;
display: flex;
justify-content: center;
margin-top: 25vh;
}
[class^='triangle'] {
position: absolute;
mix-blend-mode: multiply;
width: 300px;
height: 300px;
clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}
.triangle0 {
background: white;
mix-blend-mode: normal;
}
.triangle1 {
filter: saturate(150%);
background: black linear-gradient(50deg, darkred, white);
}
.triangle2 {
filter: saturate(200%);
background: black linear-gradient(lawngreen, white);
}
.triangle3 {
filter: saturate(150%);
background: black linear-gradient(-50deg, darkblue, white);
}
</style>
</head>
<body>
<div class="triangle0"></div>
<div class="triangle1"></div>
<div class="triangle2"></div>
<div class="triangle3"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment