Skip to content

Instantly share code, notes, and snippets.

@Legends
Last active December 25, 2019 11:58
Show Gist options
  • Select an option

  • Save Legends/e051be14de5e84fde9d8185ae52afc84 to your computer and use it in GitHub Desktop.

Select an option

Save Legends/e051be14de5e84fde9d8185ae52afc84 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
html{
position:relative;
min-height:100vh;
background:yellow;
padding:50px;
}
div{
display:block;
height:100px;
width:100px;
}
.xxx1{
position:relative;
background:green;
z-index:0;
}
/* ############################################ these css props make an element a containing block ##################### */
.xxx2{
background:#3AE2CE; /* turkis */
will-change:transform;
/* these props make .xxx2 to bethe containing block
transform: translateX(0%);
will-change:transform;
will-change:perspective;
filter: hue-rotate(90deg);
contain: paint; */
}
.xxx3{
position:relative;
background:red;
left:120px;
top:30px;
}
.xxx5{
position:fixed; /*should be based on viewport*/
background:orange;
left:10px;
top: 30px;
}
</style>
</head>
<body>
<div class="xxx0">
<div class="xxx1">green-1</div>
<div class="xxx2">
turkis-2
<div class="xxx3">red-3</div>
<div class="xxx4">
<div class="xxx5">orange-5</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment