Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div class="grid">
  <div class="col-1">
    <button type="button" class="arrow-left"><svg width="25" height="19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.994 10.599c.674 0 1.22-.6 1.22-1.2 0-.7-.546-1.3-1.22-1.3v2.5zM1 8.499c-.476.5-.476 1.2 0 1.7l7.76 7.8c.475.5 1.247.5 1.723 0s.476-1.299 0-1.699L3.587 9.4l6.896-6.9c.476-.5.476-1.302 0-1.802-.476-.4-1.248-.4-1.724 0L1 8.5zm21.994-.4H1.862v2.5h21.132v-2.5z" fill="#fff"/></svg></button>
</div>
  <div class="col-2">
    <button type="button" class="arrow-top"><svg width="19" height="24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.922 22.6c0 .6.546 1.2 1.22 1.2.672 0 1.218-.6 1.218-1.2H7.922zm2.081-22C9.527.1 8.755.1 8.28.6L.52 8.3a1.311 1.311 0 000 1.8c.476.4 1.248.4 1.724 0l6.897-6.9 6.896 6.9c.476.4 1.248.4 1.724 0a1.31 1.31 0 000-1.8L10.003.6zm.357 22V1.4H7.922v21.2h2.438z" fill="#fff"/></svg></button>
    <div class="polygon">
      <div class="block" style="left:0px; top:0px;"><svg width="61" height="61" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M59.91 36.075l-22.058-6.063L59.72 24a1.262 1.262 0 00.888-1.538C57.008 9.45 44.938.375 31.26.375c-16.772 0-30.425 13.45-30.425 30 0 16.538 13.653 30 30.425 30 14.034 0 26.178-9.375 29.538-22.8a1.237 1.237 0 00-.888-1.5zM31.26 20.562c-2.802 0-5.07-2.25-5.07-5 0-2.762 2.268-5 5.07-5 2.79 0 5.071 2.238 5.071 5 0 2.75-2.282 5-5.07 5z" fill="#FDF81B"/></svg></div>
    </div>
    <button type="button" class="arrow-down"><svg width="19" height="25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.646 2.2c0-.7-.546-1.3-1.219-1.3s-1.219.6-1.219 1.3h2.438zm-2.08 21.9c.475.5 1.247.5 1.723 0l7.758-7.7c.477-.5.477-1.3 0-1.7-.476-.5-1.248-.5-1.724 0l-6.896 6.9-6.897-6.9c-.476-.5-1.248-.5-1.724 0-.476.4-.476 1.2 0 1.7l7.76 7.7zM8.207 2.2v21.1h2.438V2.2H8.208z" fill="#fff"/></svg></button>
  </div>
  <div class="col-3">
    <button type="button" class="arrow-right"><svg width="24" height="19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.575 8.099c-.673 0-1.219.6-1.219 1.3 0 .6.546 1.2 1.219 1.2v-2.5zm21.994 2.1c.476-.5.476-1.2 0-1.7L15.81.7c-.476-.4-1.248-.4-1.724 0-.476.5-.476 1.3 0 1.8l6.897 6.9-6.897 6.901c-.476.4-.476 1.2 0 1.7s1.248.5 1.724 0l7.759-7.802zm-21.994.4h21.132v-2.5H1.575v2.5z" fill="#fff"/></svg></button>
  </div>
</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #000;
}

.grid {
  margin: 30px auto;
  max-width: 500px;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 30px;
 }

.col-1,
.col-2,
.col-3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  row-gap: 30px;
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px #fff solid;
  background-color: #000;
  width: 60px;
  height: 60px;
  border-radius: 100%;
  transition: all 0.2s ease;
}

button:hover {
  background-color: #ffffff;
 }

button:hover svg path {
  fill: #000000;
}

.polygon {
  position: relative;
  width: 300px;
  height: 300px;
  background-color: #0403DE;
  border-radius: 30px;
}

.block {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 100%;
  transition: all 0.3s ease;
}

.disabled {
  pointer-events: none;
  opacity: 0.3;
}
              
            
!

JS

              
                document.addEventListener("DOMContentLoaded", function (e) {
  let block = document.querySelector('.block');
  let leftButton = document.querySelector('.arrow-left');
  let rightButton = document.querySelector('.arrow-right');
  let topButton = document.querySelector('.arrow-top');
  let downButton = document.querySelector('.arrow-down');
  const step = 20;
  leftButton.classList.add('disabled');
  topButton.classList.add('disabled');
  
  leftButton.addEventListener('click', function(event) {
    if(parseInt(block.style.left) > 0 || parseInt(block.style.left) < 260) {
          block.style.left = parseInt(block.style.left) - step + "px";
      rightButton.classList.remove('disabled');
      }
    if(parseInt(block.style.left) == 0) {
      leftButton.classList.add('disabled');
    }
    })
  
  rightButton.addEventListener('click', function(event) {
    if(parseInt(block.style.left) < 230) {
          leftButton.classList.remove('disabled');
          block.style.left = parseInt(block.style.left) + step + "px";
      }
    if(parseInt(block.style.left) > 230) {
        rightButton.classList.add('disabled');
      }
    })
  downButton.addEventListener('click', function(event) {
    if(parseInt(block.style.top) < 230) {
          topButton.classList.remove('disabled');
          block.style.top = parseInt(block.style.top) + step + "px";
      }
    if(parseInt(block.style.top) > 230) {
        downButton.classList.add('disabled');
      }
    })
  topButton.addEventListener('click', function(event) {
    if(parseInt(block.style.top) > 0) {
          downButton.classList.remove('disabled');
          block.style.top = parseInt(block.style.top) - step + "px";
      }
    if(parseInt(block.style.top) == 0) {
        topButton.classList.add('disabled');
      }
    })
  })
    
  
              
            
!
999px

Console