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.

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="container">
  <div class="row">
    <div class="col-sm text-center mt-5">
      <h3>Fun with the Github Follow Button</h3>
    </div>
  </div>
  <div class="row">
    <div class="col-sm text-center">
      
      <p class="mt-4 mb-4">Here is the standard (unofficial) button from <a href="https://buttons.github.io/">https://buttons.github.io/</a>:</p>
      
      <a class="github-button" href="https://github.com/thecssking" data-size="large" data-show-count="true" aria-label="Follow @thecssking on GitHub">Follow @thecssking</a>
      
      <p class="mt-3 mb-4">That number is embarrassingly low, lets see if we can do better.</p>
      
       <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow">
        <span> Follow @thecssking</span>
      </a>
      <a href="#" class="social-count">
        <b></b>
        <i></i>
        <span class="infinity">&#x221E;</span>
      </a>
      <p class="mt-4 mb-4">What if your follower count matches the ratio of a circle's circumference to its diameter?</p>
      
      <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow">
        <span> Follow @thecssking</span>
      </a>
      <a href="#" class="social-count">
        <b></b>
        <i></i>
        <span class="infinity">&pi;</span>
      </a>
      
      <p class="mt-4 mb-4">Thats pretty good, but what if you have followers who are fractional?</p>  
      
      <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow">
        <span>Follow @thecssking</span>
      </a>
      <a href="https://github.com/thecssking" class="social-count">
        <b></b>
        <i></i>
        <span>412.56171999999999999999999999999...</span>
      </a>
      
      <p class="mt-4 mb-4">What if you want people to solve a math problem before they know how popular you are?</p>
      
      <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow">
        <span>Follow @thecssking</span>
      </a>
      <a href="#" class="social-count">
        <b></b>
        <i></i>
        <span>15<sup>2</sup> + &frac25; (30 <sup>11</sup> - &radic;<span class="overline">1734</span>) - &frac38;</span>
      </a>
      
      <p class="mt-4 mb-4">What if your follower count is going up in real time...</p>
      
      <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow">
        <span>Follow @thecssking</span>
      </a>
      <a href="https://github.com/thecssking" class="social-count">
        <b></b>
        <i></i>
        <span class="counter rand">99</span>
      </a>
      
      <p class="mt-4 mb-4">... rapidly?</p>
      
      <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow">
        <span>Follow @thecssking</span>
      </a>
      <a href="https://github.com/thecssking" class="social-count">
        <b></b>
        <i></i>
        <span class="counter-rapid rand">99</span>
      </a>
      
      
      <p class="mt-4 mb-4">What if you don't want people to follow you at all?  (Hover to demonstrate).</p>
      
      <div class="moving-btns">
        <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow"><span>Follow @thecssking</span></a>
        <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow"><span>Follow @thecssking</span></a>
      </div>
      
      <p class="mt-4 mb-4">Maybe you want to give users a bit more of a dictionary explanation as to what they will be doing?</p>
     
      <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow"><span>Watch the movements, progress, or course of @thecssking</span></a>
      
      <p class="mt-4 mb-4">Perhaps you would like to imply a more sinister relationship?</p>
      
        <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow"><span>Pursue @thecssking</span></a>
        <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow"><span>Shadow @thecssking</span></a>
        <a href="https://github.com/thecssking" class="fake-github-button" data-type="follow"><span>Haunt @thecssking</span></a>
      
<!--       pursue, track, shadow, stalk, haunt, tail, track, chase,  -->
      
    </div>
  </div>
  <div class="row mt-4">
    <div class="col-sm text-center">
      <p class="">
        Built by <a href="https://www.thecssking.com">Jordan</a>.  10+ hearts/likes and I will turn this into a standalone library.
      </p>
    </div>
  </div>
</div>
<script async defer src="https://buttons.github.io/buttons.js"></script>

              
            
!

CSS

              
                
/* The github buttons live in the shadow Dom, so hard to style */

.fake-github-button {
  padding: 0 10px;
  font-size: 12px;
  height: 26px;
  line-height: 26px;
  
  background-color: #eff3f6;
  background-image: linear-gradient(to bottom, #fafbfc, #e4ebf0);
  background-repeat: repeat-x;
  background-size: 110% 110%;
  
  display: inline-block;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #d1d2d3;
  border-radius: .25em;
  
  color: #222;
  text-decoration: none;
  
  &:hover {
    background-image: linear-gradient(to bottom, #f0f3f6, #dce3ec);
    border-color: #afb1b2; 
    background-color: #e6ebf1;
  }
  
  .octicon {
    height: 18px;
    top: 4px;
    position: relative;
    display: inline-block;
    vertical-align: top;
  }
  
  &:hover {
    text-decoration: none;
    color: #222;
  }  
}

.social-count {
  position: relative;
  background-color: white;
  padding: 0 7px;
  margin-left: 7px;
  font-size: 11px;
  
  line-height: 26px;
  height: 26px;
  
  display: inline-block;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #d1d2d3;
  border-radius: .25em;
  
  color: #222;
  text-decoration: none;
  outline: 0;
  
  b, i {
    margin: -5px 0 0 -8px;
    //border-width: 5px 5px 5px 0;
    
    border-right-width: 5px !important;
    border-bottom-width: 5px !important;
    border-top-width: 5px ! important;
    
    position: absolute;
    top: 50%;
    left: 0;
    display: block;
    width: 0;
    height: 0;
    border: solid transparent;
  }
  b {
    border-right-color: #d1d2d3;
  }
  i {
    margin-left: -6px;
    border-right-color: #fff;
  }
}

.infinity {
  font-size: 14px;
  line-height: 11px;
}
.overline {
  text-decoration: overline;
  color: #666;
}

.moving-btns { 
  a:first-child {
    opacity:1;
  }
  
  a:last-child {
    opacity: 0;
    cursor: default;
  }
  
  a:hover {
    opacity: 0;
    cursor: default;
    & + a {
      opacity: 1;
    }
  }
}

// To prevent reflow on counter change, which is annoying
.counter, .counter-rapid {
  width: 50px;
  display: inline-block;
}
              
            
!

JS

              
                const svg = '<svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-mark-github" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>';

function getRandomInt(max) {
  return Math.floor(Math.random() * Math.floor(max));
}

// var svgElement = document.createElementNS(svg);
var buttons = document.querySelectorAll('.fake-github-button');
var btnElement = document.createElement('span')
btnElement.innerHTML = svg + " ";

buttons.forEach(function(btn){
  let firstSpan = btn.querySelector('span');
  btn.insertBefore(btnElement.cloneNode(true), firstSpan);
})

var counters = document.querySelectorAll('.rand')
counters.forEach(function(counter){
  counter.innerHTML = getRandomInt(100000);
})

window.setInterval(function(){
  let counter = document.querySelector('.counter');
  let currentVal = parseInt(counter.innerText);
  counter.innerText = currentVal + 1 + " "
}, 1000);

window.setInterval(function(){
  let counter = document.querySelector('.counter-rapid');
  let currentVal = parseInt(counter.innerText);
  counter.innerText = currentVal + getRandomInt(10); + " "
}, 100);





              
            
!
999px

Console