Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <svg xmlns="http://www.w3.org/2000/svg" id="berlin-fernsehturm" viewBox="0 0 100 125"><desc id="desc4485">The tv tower in berlin. File from Noun Project cc Creative Commons</desc><g id="normal" fill="none" stroke="#000" stroke-width=".624"><path d="M56.812 33.303a6.788 6.788 0 0 0-4.459-6.372l-.084-6.19-.925-.041-.028-1.551-.588-.543L50.431 6H50v.191L49.999 6h-.448l-.278 12.605-.588.529-.028 1.558-.926.046-.084 6.191a6.789 6.789 0 0 0-4.459 6.373c0 3.156 2.154 5.722 5.068 6.486L48.245 41H47v3h1.078l-1.594 51h7.031l-1.593-51H53v-3h-1.23l-.025-1.212c2.913-.763 5.067-3.329 5.067-6.485z" id="path4486" clip-rule="evenodd" fill-rule="evenodd"/></g><g transform="matrix(.8407 -.02524 .26862 .9992 -17.148 1.27)" id="bounce1" fill="none" stroke="#000" stroke-width=".624"><path d="M57.817 33.196a6.761 6.761 0 0 0-4.344-6.437l.015-6.21-.922-.05-.003-1.556-.577-.55-.096-12.646-.43-.005-.003.192.002-.192-.446-.004-.478 12.638-.594.525-.053 1.562-.924.036-.182 6.208a6.853 6.853 0 0 0-4.547 6.345c-.05 3.165 2.056 5.761 4.95 6.558l-.031 1.215-1.241-.013-.048 3.009 1.075.011-2.4 51.132 7.009.074-.777-51.165 1.075.011.047-3.009-1.226-.013-.005-1.215c2.916-.735 5.104-3.286 5.154-6.45z" id="path4486-1" clip-rule="evenodd" fill-rule="evenodd"/></g><g transform="matrix(1.3148 -.0127 .41054 1.00127 -55.775 .415)" id="bounce2" fill="none" stroke="#000" stroke-width=".624"><path d="M56.812 33.303a6.788 6.788 0 0 0-4.459-6.372l-.084-6.19-.925-.041-.028-1.551-.588-.543L50.431 6H50v.191L49.999 6h-.448l-.278 12.605-.588.529-.028 1.558-.926.046-.084 6.191a6.789 6.789 0 0 0-4.459 6.373c0 3.156 2.154 5.722 5.068 6.486L48.245 41H47v3h1.078l-1.594 51h7.031l-1.593-51H53v-3h-1.23l-.025-1.212c2.913-.763 5.067-3.329 5.067-6.485z" id="path4486-1-5" clip-rule="evenodd" fill-rule="evenodd"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 125" id="berlin-bear"><path d="M51.1 52.11l-2.581-1.607-4.433-2.825c-1.493-.877-2.987-1.604-4.48-2.679-.513-.427-.943-.848-1.705-1.704-.845-.918-1.634-1.863-2.29-2.874-.585-1.069-1.284-1.854-1.753-3.214-.324-.951-.673-1.935-.974-3.264-.333-.814-.487-1.72-.974-2.678l-.779-1.315-.5-.622c.022-.14-.037-.339.466-.117.189.164.372.195.56.34.64.354.533.394.738.46l.15-.15-.4-.75-.599-.799-.083-.2c.018-.307.271-.146.466-.1l.596.432.753.634.216-.067.017-.383-1-1.281c.042-.102.075-.21.484-.067l.668.42.647.612.266.167.117-.267-1.033-1.365c-.023-.267.106-.383.583-.15l.553.401.68.748.249-.167-.217-.599-.682-.882c.2-.142.453-.07.714.037.427.133.599.287.9.545.62.579.954 1.3 1.333 1.998.244.541.488 1.054.732 1.532l.233.6.233 1.165.25 1.115.466 1.265.6.982.59.81.665.612.936.695.306.188 1.154.554 1.789.682 2.213.683 2.684.754 2.402.659 1.765.518.73.07z" id="top-arm" fill-rule="evenodd" stroke="#000" stroke-width=".05"/><path d="M48.967 45.688l-.5.533-1.482 1.015-2.247 1.366-1.665.865-2.664 1.182-1.93.716-.783.283-.516.017-.477-.206-.36-.343-.588-.817-.735-1.259-1.177-1.83-.948-1.471-.408-.49-.727-.932-.716-.856-.54-.287-.55-.15-.499.084-.25.083.117.283.35.266.35.333.299.417.083.4-.233.066-.683-.716-.507-.275-.417-.066-.4.091-.199.083.117.208.333.258.566.525.25.358.04.3-.14.091-.275-.175-.608-.582-.558-.308-.4-.1-.39.05-.167.125.192.274.35.325.357.366.3.358.091.35-.075.183-.2-.05-.674-.65-.557-.25-.525-.074-.374.15.15.333.432.408.516.532.258.45.017.3-.2-.067-.466-.341-.49-.25-.55-.075-.4.1-.066.1.258.35.39.44.6.617.408.615.533.962.337.75.175.494.293.728.442.774.542.84.891 1.296 1.125 1.082.683.553.636.506.565.412.977.494.86.377 1.106.424 1.824.506 2.967.153 2.31-.029 1.414-.133 1.798-.216 1.732-.3 3.623-.593z" id="bottom-arm" fill-rule="evenodd" stroke="#000" stroke-width=".2"/><path d="M46.075 41.426c-1.71 2.531-2.916 13.899-.183 19.49.515 2.675 2.633 5.228 3.402 6.165.887 1.393.602 2.083-.957 2.477-.701.178-1.373.527-2.02.879-2.53 1.388-4.986 3.899-6.183 5.862-1.374 2.242-2.586 5.884-2.765 6.872-.18.993-.108 6.71-.082 7.322.045.969.322 1.413-.2 1.697-.447.248-.874-.112-1.272-.323-1.162-.62-2.852-1.386-4.11-1.8l-.307-.113c-.738-.283-1.162-.176-1.896-.366-1.464-.387-2.26.21-2.405.53-.114.25.898.159 1.414.363.267.108.37.213.42.288.135.258-.083.283-.083.283-.522-.135-.933-.227-1.268-.18-.604.084-.932.452-1.024.659-.116.249.877.1 1.457.318.188.068.266.056.396.166.45.374-.172.38-.172.38-1.467-.387-2.127.107-2.271.43-.115.25 1.12.246 1.629.46.084.033.152.079.229.118.288.256.21.45-.016.396-1.437-.323-2.061.194-2.208.515-.114.247 1.136.322 1.656.5.3.107.373.16.537.278.172.158.006.22-.05.217a5.302 5.302 0 0 0-.771 0c-.681.05-1.084.397-1.193.636-.112.246 1.264.397 1.867.58.646.205 2.55 1.072 2.55 1.072.56.317 2.723.843 4.939 1.8.98.422 1.93.91 2.903 1.34 1.154.509 2.317.593 3.628.522 1.252-.07 2.032-.713 2.403-1.821.447-1.347.756-2.735 1.166-4.097.877-2.912 2.289-5.438 4.437-7.71 1.5-1.582 3.272-2.623 5.114-3.663.704-.397 1.04-.042 1.4.426 2.782 3.572 5.55 7.153 8.343 10.715.618.787.048 1.086-.446 1.324-.427.19-.926.32-1.265.343-.79.047-2.203.249-2.95.378-1.495.26-1.97 1.13-1.97 1.485 0 .273.884-.231 1.438-.26.287-.013.42.039.502.085.229.18.043.296.043.296-.533.094-.943.18-1.23.362-.516.323-.661.798-.661 1.025 0 .272.842-.273 1.46-.316.2-.02.382-.041.43-.02.518.275 0 .42 0 .42-1.493.26-1.89.984-1.89 1.336 0 .274 1.125-.24 1.676-.255.09-.006.17.005.259.009.368.114.375.323.148.37-1.44.302-1.795 1.03-1.795 1.383 0 .274 1.167-.177 1.716-.23.317-.026.403-.011.604.03.228.074.098.194.042.217-.24.089-.474.195-.7.319-.602.327-.821.812-.821 1.073 0 .273 1.415-.212 1.97-.23.747-.022 1.305.218 2.204.046.932-.181 2.539-.926 3.646-1.416 2.195-1.185 4.438-2.778 5.559-4.243.863-1.135 1.339-1.953 1.786-3.45.192-.648.27-1.807.17-2.542-.473-3.598-2.505-6.578-1.77-11.791.259-1.833-.254-3.2.136-3.587 1.548-1.55 1.736-3.598.344-4.958-.215-.207-1.062-.7-1.636-1.464-.35-.453-.37-1.34-.466-1.918-.575-3.494-1.99-6.762-3.114-10.148-.45-1.354-.837-2.828-1.037-4.255-.466-3.34 1.168-6.374 2.284-9.375 1.05-2.822 1.764-5.467-.037-8.662-.903-1.602.42-2.702 1.103-3.961 1.838-3.391 1.646-6.947 1.03-10.557-.208-1.245-.231-1.276.253-1.934.907-1.215.717-2.493-.192-3.64-.924-1.165-2.15-1.464-3.536-.96-.448.159-.768.397-1.321.135-2.036-.944-4.26-.951-6.427-.698-4.021.468-7.751 2.473-11.877 2.494-.913.003-.831.552-.768 1.146.193 1.752.992 3.244 1.93 4.707.494.767.959 1.052 1.923.935 1.56-.19 3.375-.056 4.742 1.636-3.701-.481-7.625.444-10.321-2.861-.188 2.166.967 3.126 2.615 3.709 1.9.67 3.715.71 5.75 1.08.607.11 2.246.238 2.246.325 0 .303-3.037.188-4.116.418-.336.074-1.027.104-1.327.269-.521.293-1.004.7-.883 1.336.113.588.747.637 1.235.742 1.058.238 2.122.452 3.192.643.712.129 1.163.305.434 1.029-1.847 1.832-4.223 2.936-6.251 4.516-.517-.11-2.787 4.544-2.669 4.748m14.092-21.062c-.484.292-.883.183-1.09-.198-.694-1.268-1.973-2.076-3.021-.04-.115.229-.572.37-.795.317-.283-.068-.333-.42-.222-.707.446-1.185 1.036-2.202 2.499-2.158 1.458.05 2.696 1.527 2.83 2.227.034.185-.072.482-.201.559zm6.689-.215c-.312.068-.664-.092-.995-.148.068-.33.05-.722.23-.98.8-1.157 2.02-1.36 3.556-1.447-.501 1.599-1.483 2.296-2.791 2.575z" id="path2" clip-rule="evenodd" fill-rule="evenodd" stroke="#000" stroke-width=".2"/></svg>

<script>
  var normal = $("#normal");
  var bounce1 = $("#bounce1");
  var bounce2 = $("#bounce2");
  
  var tl = new TimelineMax({ yoyo: true, repeat: -1 });
  
  tl
    .to(normal, 0.1, { opacity: 0 })
    .to(bounce1, 0.1, { opacity: 1 })
    .to(bounce1, 0.01, { opacity: 0 })
    .to(bounce2, 0.1, { opacity: 1 })
    .to(bounce2, 0.01, { opacity: 0 });
  
  var arm1 = $("#top-arm");
  var arm2 = $("#bottom-arm");
  
  var tl2 = new TimelineMax({ yoyo: true, repeat: -1 });
  
  tl2
    .to(arm1, 0.1, { rotation: 15, transformOrigin: "right bottom" })
    .to(arm2, 0.1, { rotation: 30, transformOrigin: "right center" });
  
  function playAll() {
    tl.play();
    tl2.play();
  }
  
  function stopAll() {
    tl.pause();
    tl2.pause();
  }
</script>
<input type="button" id="ampelmann-green-btn" onclick="playAll()" />
<input type="button" id="ampelmann-red-btn" onclick="stopAll()" />
            
          
!

CSS

            
              #berlin-fernsehturm {
  position: absolute;
  top: 50px;
  left: 25px;
  width: 400px;
  height: 450px;
}

#berlin-fernsehturm #normal {
  opacity: 1;
}

#berlin-fernsehturm #bounce1 {
  opacity: 0;
}

#berlin-fernsehturm #bounce2 {
  opacity: 0;
}

#berlin-bear {
  position: absolute;
  top: 50px;
  left: 110px;
  width: 400px;
  height: 440px;
}

#ampelmann-green {
  position: absolute;
  top: 400px;
  left: 50px;
  width: 100px;
  height: 100px;
}

#ampelmann-red {
  position: absolute;
  top: 410px;
  left: 150px;
  width: 100px;
  height: 90px;
}

#ampelmann-green-btn {
  position: absolute;
  top: 400px;
  left: 80px;
  width: 77px;
  height: 77px;
  border: none;
  background-image: url('data:image/svg+xml;charset=utf8, <svg xmlns="http://www.w3.org/2000/svg" id="ampelmann-green" viewBox="0 0 144 144"><desc>The green man for the traffic lights to indicate you can cross the street. By Anna Weiss, SE from Noun Project cc Creative Commons</desc><path style="fill:green" d="M109.784 98.773c-.2.6-.5 1.1-.7 1.7-.5 1.1-1 2.1-1.5 3.2-.4.8-.8 1.6-1.3 2.4-1.8 2.6-3.9 4.8-6.8 6.4-2 1.1-3.8 2.3-5.7 3.5-.6.3-1.3.6-2 .9-.3-1.6-1.5-2.4-2.4-3.4-1.5-1.6-2.9-3.3-4.4-5-3.4-4-6.7-8-10.1-12-2.2-2.6-4.3-5.2-6.5-7.8-.4-.4-.6-.9-.9-1.4-.6.2-.8.6-.9 1.1-.2.6-.6 1.1-1 1.7-.5.8-1.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.7 1.4-1.1 3-2 4.6-2.8.7-.3 2.7.8 2.8 1.2.4 1.1.8 2.2 1.1 3.3.3 1.3-.7 3.1-2 3.9-.7.4-1.4 1-2 1.5-.5.4-.5.9-.1 1.2.5.4.4.9.5 1.4.1.6 0 1-.6 1.3-.5.2-2.6 1.4-3.2 1.9-2.3 1.9-4.7 3.8-7.1 5.7-1.5 1.2-2.9 2.4-4.5 3.5-1 .7-1.3 1.6-1.8 2.6 0 .1-.1.2 0 .3.7.9.4 2.4 1.8 3.1.3-.2 1.6 1.6 2.2 2.4.8 1 1.9 1.8 2.5 2.9 1 1.7 2.5 3 3.8 4.5.5.5.8 1.2 1.3 1.7.9 1 2 1.9 2.9 2.9.5.5.9 1 1.3 1.5.8.8 1.5 1.6 2.9 1.3 1.3-.3 2.7-.4 4.1-.7.7-.1 1.4-.4 2.2-.6 1.1.1 2.1 0 3.2-.2z"/></svg>');
  background-color: white;
  background-repeat: no-repeat;
}

#ampelmann-green-btn:hover {
  background-color: #00ff00;
}

#ampelmann-red-btn {
  position: absolute;
  top: 400px;
  left: 150px;
  width: 77px;
  height: 77px;
  border: none;
  background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" id="ampelmann-red" viewBox="0 0 144 144"><desc id="desc4485">The red man for the traffic lights to indicate you cannot cross the street. By Anna Weiss, SE from Noun Project cc Creative Commons</desc><g id="g4489" transform="matrix(.86783 0 0 .94426 26.71 23.043)" fill="red"><path d="M88.42 35.28c-1.596 0-2.43.989-3.722.989-1.292 0-1.367-1.747-2.583-1.747-1.215 0-11.319-.684-14.965-1.595-3.647-.912-11.016-4.33-10.902-5.66.068-.803 1.025-1.709 2.62-2.62 3.567-2.039 4.444-6.382 6.837-8.547 2.394-2.164 5.242-1.823 5.014-2.734-.228-.912-3.304-1.025-6.267-1.595-4.077-.784-6.07-7.5-14.471-7.521l-.019.001-.02-.001v.001c-8.398.021-10.318 6.736-14.396 7.521-2.963.569-6.039.683-6.267 1.595-.229.911 2.62.57 5.014 2.734 2.393 2.165 3.27 6.508 6.837 8.547 1.595.911 2.552 1.817 2.62 2.62.113 1.33-7.255 4.748-10.902 5.66-3.646.911-13.75 1.595-14.965 1.595-1.216 0-1.291 1.747-2.583 1.747-1.292 0-2.126-.989-3.722-.989-1.595 0-3.95.687-3.95 3.57 0 2.885 1.821 4.257 3.568 4.257s2.812-1.063 4.026-1.063c1.217 0 1.673 2.504 2.66 2.504.988 0 6.685.687 11.091.687 4.405 0 6.714 2.593 7.141 7.521.457 5.28.795 10.615 2.395 18.612.569 2.849 3.646 18.175 3.646 19.827 0 1.373-.571 1.861-1.331 1.938-.76.077-1.899.189-1.899.722 0 .523 6.783 1.855 10.979 1.895v.002l.094-.001.094.001v-.002c4.196-.039 10.979-1.371 10.979-1.895 0-.532-1.14-.59-1.899-.665-.759-.075-1.331-.621-1.331-1.994 0-1.481 3.077-16.979 3.646-19.827 1.6-7.997 1.938-13.332 2.395-18.612.427-4.928 2.735-7.521 7.141-7.521 4.406 0 10.103-.687 11.091-.687.987 0 1.443-2.504 2.66-2.504 1.215 0 2.279 1.063 4.026 1.063 1.747 0 3.568-1.372 3.568-4.257.002-2.885-2.353-3.572-3.948-3.572z" id="path4487"/></g></svg>');
  background-color: white;
  background-repeat: no-repeat;
}

#ampelmann-red-btn:hover {
  background-color: #ff7d78;
}

            
          
!

JS

            
              var normal = $("#normal");
var bounce1 = $("#bounce1");
var bounce2 = $("#bounce2");

var tl = new TimelineMax({yoyo: true, repeat: -1});

tl.to(normal, 0.1, {opacity:0})
  .to(bounce1, 0.1, {opacity:1})
  .to(bounce1, 0.01, {opacity:0})
  .to(bounce2, 0.1, {opacity:1})
  .to(bounce2, 0.01, {opacity:0});

var arm1 = $("#top-arm");
var arm2 = $("#bottom-arm");

var tl2 = new TimelineMax({yoyo: true, repeat: -1});

tl2.to(arm1, 0.1, {rotation:15, transformOrigin: "right bottom"})
  .to(arm2, 0.1, {rotation:30, transformOrigin: "right center"});


  function playAll(){
        tl.play();
        tl2.play();
  }

 function stopAll(){
          tl.pause();
          tl2.pause();
  }
            
          
!
999px

Console