Pen Settings

↑ Insert the most common viewport meta tag

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation


Save Automatically?

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

Want a Run Button?

If active, the preview will update automatically when you change code.


              <div id="transition"></div>

Open your console :)


              #transition {
  top: 0;
  width: 50px;
  height: 50px;
  background: blue;
  -webkit-transition: top 1s linear;
  -moz-transition: top 1s linear;
  -ms-transition: top 1s linear;
  -o-transition: top 1s linear;
  transition: top 1s linear;



A function that will take a transition-timing-function from an element and return it as a cubic-bezier() function should it not be one. This is needed because WebKit currently returns the transition-timing-function property as a keyword (such as "linear"), whereas other browsers will return the cubic-bezier(). If a browser returns a cubic-bezier(), this function will leave it alone so that you always get a cubic-bezier() consistently. This issue was detailed here:

Open your console to see the original timing-function, followed by the converted one

Note: The code below doesn't make getting an element's transition-timing-function 100% bullet-proof because you will almost certainly need to query the prefixed versions of style.transitionTimingFunction too, such as style.webkitTransitionTimingFunction. In Sequence.js (where this code is taken from), we use Modernizr to query the prefix required for CSS3 transitions, then return the transition-timing-function for the prefix being used.


var element = document.getElementById('transition'); //get the element you want the timing-function of

var style = element.currentStyle || window.getComputedStyle(element, null); //get the styles for that element

var timingFunction = style.transitionTimingFunction; //specifically select the transitionTimingFunction from the styles

function convertTimingFunctionToCubicBezier(timingFunction) {
  var timingFunctionToCubicBezier = {
      "linear" : "cubic-bezier(0.0,0.0,1.0,1.0)",
      "ease"   : "cubic-bezier(0.25, 0.1, 0.25, 1.0)",
      "ease-in": "cubic-bezier(0.42, 0.0, 1.0, 1.0)",
      "ease-in-out": "cubic-bezier(0.42, 0.0, 0.58, 1.0)",
      "ease-out": "cubic-bezier(0.0, 0.0, 0.58, 1.0)"
  if(timingFunction.indexOf("cubic-bezier") < 0) { //if the timing-function returned isn't a cubic-bezier()
    timingFunction = timingFunctionToCubicBezier[timingFunction]; //convert it to one!
  return timingFunction; //return a cubic-bezier() please, thank you muchly!

console.log("original:", timingFunction);
console.log("converted:", convertTimingFunctionToCubicBezier(timingFunction));
Loading ..................