Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="poster">
  <img src="" alt="" class="poster__c3po-profile">
  <img src="" alt="" class="poster__c3po--eyes">
  <img src="" alt="" class="c3po__foreground">
  <img src="" alt="" class="poster__c3po--base-2">
  <img src="" alt="" class="poster__c3po--base-1">
  <img src="" alt="" class="poster__c3po--base">
  <img src="" alt="Star Wars" class="poster__title">

<div class="credit">
  <a class="credit__link" href="" target="_blank" rel="noopener noreferrer" title="Olly Moss">Poster By Olly Moss</a>


                :root {
  --beige: #fff2d7;
  --move-x: 0px;
  --move-y: 0px;

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #efefef;
  padding-top: 25px;

.poster {
  position: relative;
  width: 500px;
  height: 800px;
  background-color: var(--beige);
  box-shadow: 0px 30px 60px -20px rgba(0, 0, 0, 0.4);
  overflow: hidden;

.poster * {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 500px;
  height: 800px;
  transition: all 0.01s linear;

.poster__title {
  z-index: 10;

.c3po__foreground {
  z-index: 4;

.poster__c3po--base-2 {
  z-index: 3;

.poster__c3po--base-1 {
  z-index: 2;

.poster__c3po--base {
  bottom: auto;
  top: 0;
  z-index: 1;

.poster__c3po--eyes {
  z-index: 2;
  bottom: auto;

// layers
@for $i from 7 through 1 {
  // i have less than i expected
  .poster img:nth-of-type(#{$i}) {
    transform: translateX(calc(var(--move-x) * #{-0.7*$i}))
      translateY(calc(var(--move-y) * #{-2*$i}));

.poster__c3po-profile {
  transform: translateX(0) translateY(0) !important;
  z-index: 11;

.credit {
  margin-top: 1em;

.credit__link {
  background-color: black;
  color: white;
  text-decoration: none;
  padding: 4px 6px;
  font-family: -apple-system, BlinkMacSystemFont, "San Francisco",
    "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial,
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
  display: inline-block;
  border-radius: 3px;



                const poster = document.querySelector(".poster");
const posterDims = {
  w: poster.getBoundingClientRect().width,
  h: poster.getBoundingClientRect().height
const limit = {
  x: 15,
  y: 3

poster.addEventListener("mousemove", (e) => {
  const mouse = {
    x: e.pageX / 2,
    y: e.pageY
  const clamped = {
    x: (mouse.x / posterDims.w * limit.x - (limit.x / 2)),
    y: (mouse.y / posterDims.h * limit.y - (limit.y / 2))
  };"--move-x", clamped.x+'px');"--move-y", clamped.y+'px');

//device orientation doesn't seem to work on codepen