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 id="root" />


                :root {
  --scale: 1.5
  --y: 0;
  overflow: hidden;
body {
  margin: 0;
  background-color: black;
  outline: none;
  border: none;
    #wrapper {
    width: 100vw;
    height: 100vh;
      #image {
        width: 100vw;
        height: 100vh;
        background-image: url("");
        background-size: cover;
        transform: translateX(var(--x)) translateY(var(--y)) scale(var(--scale));
        transition: ease-out 0.7s;


                // 4/26/2022 Update: This is not quite an example of parallax by some's standards. This was just a simple and incomplete attempt to learn parallax that I thought no one would notice. I did not anticipate this experimental pen to get so many views and I credit the awesomeness of Andre Benz's photography for that completely. 
// ----------------------------------
// A part of my effort to learn parallax.
// Photo Cred: Andre Benz @

class App extends React.Component {
  handleMouseMove = (e) => {
    const el = document.getElementById("wrapper");
    const d = el.getBoundingClientRect();
    let x = e.clientX - (d.left + Math.floor(d.width / 2));
    let y = e.clientY - ( + Math.floor(d.height / 2));
    // Invert values
    x = x - x * 2;
    y = y - y * 2;"--scale", 1.6);"--x", x / 2 + "px");"--y", y / 2 + "px");

  handleMouseLeave = () => {"--scale", 1);"--x", 0);"--y", 0);
  render() {
    return (
        <img id="image" />

ReactDOM.render(<App />, document.getElementById("root"));