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

            
              <div class="window-container is-visible">
  <div class="window-controls">
    <button class="window-controls-btn close-btn"></button>
    <button class="window-controls-btn minimize-btn"></button>
    <button class="window-controls-btn expand-btn"></button>
  </div>
  <div class="window-content"></div>
</div>
            
          
!

CSS

            
              body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  font-size: 19px;
  font-family: 'Source Code Pro', monospace;
  background: #c4ff6d;
}

// Window
.window-container {
  width: 700px;
  height: 400px;
  border: 1px solid #bbb;
  border-radius: 7px;
  box-shadow: 0 22px 70px 4px rgba(0, 0, 0, 0.56);
  background: rgb(233, 233, 233);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.window-controls {
  display: flex;
  padding: 5px;
  background: linear-gradient(rgb(226, 224, 226), rgb(199, 198, 200));
}

.window-controls-btn {
  position: relative;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0;
}

.close-btn {
  background: rgb(227, 69, 69);
}

.minimize-btn {
  background: rgb(224, 178, 40);
}

.expand-btn {
  background: rgb(0, 216, 67);
}

.window-content {
  display: flex;
  flex-direction: column;
  flex: 0 0 95%;
  background: #000;
  overflow-y: scroll;
}

.line {
  color: #fff;
  margin: 0;
  padding: 3px 5px;;
}
            
          
!

JS

            
              const windowContent = document.querySelector(".window-content");

function getLastLine () {
  const lines = document.querySelectorAll(".line");
  return lines[lines.length - 1]
}

function createContent(value) {
  const line = document.createElement("p");
  line.classList.add("line");
  line.textContent = "~  " + value;
  return line;
}

function render(value) {
  const content = createContent(value);
  windowContent.appendChild(content);
  const topPos = content.offsetTop;
  windowContent.scrollTop = topPos;
}

function initCommand() {
  const command = [..."fizzbuzz init "];
  render("");
  const line = getLastLine();
  let timeout = false;
  command.forEach((char, i) => {
    timeout = setTimeout(() => {
      line.textContent += char;
      if (i === command.length - 2) {
        clearTimeout(timeout);
        timeout = false;
        timeout = setTimeout(() => {
          render("");
          loading();
        }, i * 50);
      }
    }, i * 150);
  });
}

function loading() {
    const command = [..."....."];
    const line = getLastLine();
  line.textContent += 'loading';
    let timeout = false;
    command.forEach((char, i) => {
      timeout = setTimeout(() => {
        line.textContent += char;
        if (i === command.length - 2) {
          clearTimeout(timeout);
          timeout = false;
          timeout = setTimeout(() => {
            outputting();
          }, i * 50);
        }
      }, i * 350);
    });
}

function outputting () {
  const line = getLastLine();
  let timeout = false;
  for (let i = 1; i <= 101; i++) {
    timeout = setTimeout(() => {
      let content = i;
      if (i%5 === 0 && i%3 === 0) {
        content = "FizzBuzz";
      } else if (i%5 === 0) {
        content = "Buzz";
      } else if (i%3 === 0) {
        content = "Fizz";
      } else if (i === 101) {
        content = "✨ fizzbuzz finished";
        clearTimeout(timeout);
        timeout = false;
      }
      render(content);
    }, i * 50);
  }
}

initCommand();
            
          
!
999px

Console