Skip to content

Instantly share code, notes, and snippets.

@loucadufault
Created November 5, 2022 06:17
Show Gist options
  • Save loucadufault/d4e30db09d9b2bcc9b40f04c7c15e979 to your computer and use it in GitHub Desktop.
Save loucadufault/d4e30db09d9b2bcc9b40f04c7c15e979 to your computer and use it in GitHub Desktop.
Overlays three side-by-side translucent rectangles in HTML that can be colored differently with CSS to visualize how those colors appear once overlayed.
.rect {
height: 100px;
width: 100px;
position: absolute;
}
.middle {
width: 150px;
margin-left: 50px;
z-index: 1;
}
.right {
margin-left: 150px;
z-index: 2;
}
.translucent {
opacity: 0.5;
}
.bottom {
margin-top: 50px;
width: 250px;
}
.color1 {
background-color: blue;
}
.color2 {
background-color: magenta;
}
.color3 {
background-color: dodgerblue;
}
<div class="rect translucent color1">
</div>
<div class="rect middle translucent color2">
</div>
<div class="rect right translucent color1">
</div>
<!-- <div class="rect bottom translucent color3">
</div> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment