Skip to content

Instantly share code, notes, and snippets.

@valdrinkoshi
Created August 10, 2016 21:15
Show Gist options
  • Save valdrinkoshi/79f10cef77f2e268b7b8adb6de9f41be to your computer and use it in GitHub Desktop.
Save valdrinkoshi/79f10cef77f2e268b7b8adb6de9f41be to your computer and use it in GitHub Desktop.
Stacking context causes cropping
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<title>Stacking context causes cropping</title>
<style>
#container {
border: 1px solid gray;
width: 200px;
height: 200px;
overflow: hidden;
/* creates a new stacking context */
transform: translateZ(0);
}
.fixed {
position: fixed;
padding: 20px;
top: 100px;
left: 60px;
width: 400px;
height: 400px;
background-color: yellow;
z-index: 9999;
}
</style>
</head>
<body>
<div id="container">
<div class="fixed">
I should be cropped!
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment