css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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.

              <div id="tree" class="tree">
    Put markup here.
    Even go arbitrary XML, if you like.
        <a href="#">A link</a>
        <a href="#">Another link</a>
      <img src="http://enes.in/f.png" />
      <p>Ea commodo consequat duis autem vel eum iriure dolor in hendrerit.</p>
      <p>Decima eodem modo typi qui nunc nobis videntur.</p>
      <p>Tincidunt ut laoreet dolore magna, aliquam erat volutpat ut wisi enim ad minim.</p>
      <p>Id quod mazim, placerat facer possim assum typi non!</p>
      <p>Legere me lius quod ii, <a href="#">legunt saepius</a> claritas.</p>
      <p>Gothica quam nunc putamus parum claram anteposuerit litterarum formas humanitatis per seacula.</p>
        <li><a href="#">Foo</a></li>
        <li><a href="#">Bar</a></li>
        <li><a href="#">Bam</a></li>
        <li><a href="#">Baz</a></li>
        <li><a href="#">Trek</a></li>
              $height: 4.5vw;

html, body {
  width: 100%;
  height: 100%;

body {
  font: normal 100 100%/1.5 helvetica, arial, sans-serif;
  perspective: 500px;

.tree {
  position: relative;
  * {
    box-sizing: border-box;
    position: absolute;
    display: block;
    height: $height;
    bottom: $height * -2;
    transform: translateX(5%);
    font-size: .95em;
    text-align: center;
    line-height: $height;
    border: 1px solid transparent;
    border-radius: 3px;
    background: #999;
    color: #fff;
    transition: all .3s;
    &:hover {
      background: #27f;
      border-color: black;
      &::before {
        background: black;
    &::before {
      content: "";
      position: absolute;
      top: -$height;
      left: 50%;
      transform: translate(-5%);
      width: 2px;
      height: calc(#{$height} - 1px);
      background: inherit;

@media (max-width: 500px) {
  .tree {
    width: 175%;
    * {
      height: 30px;
      bottom: 30px * -2;
      line-height: 30px;

      &::before {
        top: -30px;
        height: 29px;

@media (max-width: 300px) {
  .tree {
    width: 250%;
              var App = (function() {
  function getLevelNodes(node) {
    return Array.from(node.parentNode.children)
  function getChildIndex(node) {
    return getLevelNodes(node).indexOf(node)
  function tagNodeName(node) {
    node.innerHTML = node.nodeName + node.innerHTML
  function clearInside(node) {
    Array.from(node.childNodes).forEach(child => {
      if (child.nodeName === '#text') {
  function handleImage(node) {
    if (node.nodeName === 'IMG') {
      node.src = ''
      node.alt = 'IMG'
  function walk(node, cb) {
    if (node.children.length) {
      walk(node.children[0], cb)
    if (node.nextElementSibling) {
      walk(node.nextElementSibling, cb)
  function init() {
    var $el = document.getElementById('tree')
    walk($el.children[0], node => {
      var levelNodes = getLevelNodes(node)
      var childIndex = getChildIndex(node)
      var width = 90 / levelNodes.length
      var leftSlice = 100 / levelNodes.length
      var left = leftSlice * childIndex
      node.style.cssText += `;
        width: ${width}%;
        left: ${left}%;
  return { init }

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................