Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
Last active April 4, 2019 18:43
Show Gist options
  • Select an option

  • Save sandipchitale/3380f3e2a09fb1a4ee3f0d4448343618 to your computer and use it in GitHub Desktop.

Select an option

Save sandipchitale/3380f3e2a09fb1a4ee3f0d4448343618 to your computer and use it in GitHub Desktop.
Layers
<html>
<head>
<style>
html,
body {
top: 0;
left: 0;
}
.bordered {
border: 1px solid black;
background-color: lightgray;
max-width: 512px;
max-height: 512px;
overflow: auto;
margin: auto;
}
.substrate {
width: 1024px;
height: 1024px;
display: grid;
grid-template-columns: 1fr;
overflow: hidden;
}
.scaled {
display: inline-block;
transform-origin: 50% 50%;
transform: translate(-100%, -100%);
transform: scale(.5);
}
.layer-container {
display: grid;
grid-template-columns: 1fr;
overflow: auto;
cursor: crosshair;
}
.layer {
grid-row-start: 1;
grid-column-start: 1;
}
.center {
justify-self: unsafe center;
align-self: unsafe center;
}
.west {
justify-self: unsafe start;
align-self: unsafe center;
}
.east {
justify-self: unsafe end;
align-self: unsafe center;
}
.north {
justify-self: unsafe center;
align-self: unsafe start;
}
.south {
justify-self: unsafe center;
align-self: unsafe end;
}
.north-west {
justify-self: unsafe start;
align-self: unsafe start;
}
.north-east {
justify-self: unsafe end;
align-self: unsafe start;
}
.south-west {
justify-self: unsafe start;
align-self: unsafe end;
}
.south-east {
justify-self: unsafe end;
align-self: unsafe end;
}
</style>
</head>
<body>
<div class="bordered">
<div class="substrate">
<div class="scaled center">
<div class="layer-container">
<img src="https://via.placeholder.com/512.png/f00/fff?text=%20" class="layer center" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=C" class="layer center" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=W" class="layer west" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=E" class="layer east" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=N" class="layer north" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=S" class="layer south" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=NW" class="layer north-west" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=NE" class="layer north-east" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=SW" class="layer south-west" />
<img src="https://via.placeholder.com/128.png/00f/fff?text=SE" class="layer south-east" />
</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment