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.



Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO


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.


Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:


Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO


                <div id="container">
  <div id="image"></div>



#container {
  position: absolute;
  width: 700px;
  height: 400px;
  top:0; left:0; bottom:0; right:0;
  margin: auto;

#image {
  position: absolute;
  width: 500px;
  height: 281px;
  top:0; left:0; bottom:0; right:0;
  margin: auto;
  background-image: url( "" );


var image = document.getElementById("image");

//always from start to end, value goes from 0 to 1
var shadowProgress = {value: 0};
var shadowTL = new TimelineMax({repeat: -1});, 1, {
    value: 1, ease: Bounce.easeOut, onUpdate: updateFilter, onUpdateParams: ["{self}", {filter: 'drop-shadow', start: "0px 0px 0px rgba(0, 0, 0, 1)", end: "50px 50px 10px rgba(0, 0, 128, 0.3)"}]
shadowTL.set(shadowProgress, {value: 0});, 1, {
    value: 1, ease: Power3.easeIn, onUpdate: updateFilter, onUpdateParams: ["{self}", {filter: 'drop-shadow', start: "50px 50px 10px rgba(0, 0, 128, 0.3)", end: "0px 0px 0px rgba(0, 0, 0, 1)"}]

//not rotating backwards, only from 0 to 360, then its set back to 0 instantly
var hueProgress = {value: 0};
var hueTL = new TimelineMax({repeat: -1});, 5, {
    value: 1, ease: Power0.easeNone, onUpdate: updateFilter, onUpdateParams: ["{self}", {filter: 'hue-rotate', start: "0deg", end: "360deg"}]
hueTL.set(hueProgress, {value: 0}); //seems it works without this line the same way, but I dont know what sets the value back to 0 then..

//value goes from 0 to 1 then from 1 to 0, start and end values are the same in both directions
var brightnessProgress = {value: 0};
var brightnessTL = new TimelineMax({repeat: -1});, 8, {
    value: 1, ease: SteppedEase.config(12), onUpdate: updateFilter, onUpdateParams: ["{self}", {filter: 'brightness', start: "0%", end: "100%"}]
});, 8, {
    value: 0, ease: SteppedEase.config(12), onUpdate: updateFilter, onUpdateParams: ["{self}", {filter: 'brightness', start: "0%", end: "100%"}]

var actualFilterValues = {};

function updateFilter(tween, obj) {
    var i, l, progress =;
    var start = obj.start;
    var end = obj.end;
    var filter = obj.filter;

    var vendorPrefixes = ["", "-webkit-"];

    var startMatchArray = start.match(/([\d\.]+)/g);
    var endMatchArray = end.match(/([\d\.]+)/g);
    var actualNumberArray = [];

    for (i = 0, l = startMatchArray.length; i < l; i++) {
        startMatchArray[i] = parseFloat(startMatchArray[i]);
        endMatchArray[i] = parseFloat(endMatchArray[i]);
        var valueDifference = endMatchArray[i] - startMatchArray[i];
        var intermediateValueOffset = valueDifference * progress;
        actualNumberArray[i] = startMatchArray[i] + intermediateValueOffset;

    var matchIndex = 0;
    var roundNumbersCount = 0;
    var finalEffectValue = start.replace(/([\d\.]+|rgb)/g, function (match) {
        if (match === "rgb") {
            roundNumbersCount = 3;
            return match;
        if (roundNumbersCount > 0) {
            actualNumberArray[matchIndex] = Math.round(actualNumberArray[matchIndex]);
            actualNumberArray[matchIndex] = actualNumberArray[matchIndex] < 255 ? actualNumberArray[matchIndex] : 255;
            actualNumberArray[matchIndex] = actualNumberArray[matchIndex] > 0 ? actualNumberArray[matchIndex] : 0;
        return actualNumberArray[matchIndex++];

    actualFilterValues[filter] = finalEffectValue;

    var finalFilterValue = "";
    for (var filterEffectName in actualFilterValues) {
        finalFilterValue += filterEffectName + "(" + actualFilterValues[filterEffectName] + ") ";

    for (i = 0; i < vendorPrefixes.length; i++) {
        var currentVendorFilter = vendorPrefixes[i] + "filter";[currentVendorFilter] = finalFilterValue;
If you want to flex your skills and go off the grid, try coding a layout with float.