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">
  
  <h1>Twitter buttons with no iframe</h1>  
  
<h3>Custom Tweet button</h3>
  
<div class="custom-tweet-button">
  <a href="https://twitter.com/intent/tweet?url=https://codepen.io/alistairtweedie/&amp;text=Twitter buttons for mobile - no iframes yay! from @alistairtweedie&amp;via=codepen" target="_blank" alt ="Tweet this pen">
    <i class="btn-icon"></i>
    <span class="btn-text">Tweet</span>
  </a>
</div>

<h3>Custom Follow button</h3>  
  
<div class="custom-follow-button">
  <a href="https://twitter.com/intent/user?screen_name=alistairtweedie" target="_blank" alt="Follow alistairtweedie">
    <i class="btn-icon"></i>
    <span class="btn-text">Follow @alistairtweedie</span>
  </a>
</div>
  
  <p>Embedding Tweet and Follow buttons on responsive sites can be a bit of a touchy subject. Including them can increase page load time greatly.</p> 

  <p>By creating a custom button we have a 'lite' version for mobile devices that won't slow the page down. </p>
    
   <p>Some functionality of the iframed versions isn't available but anyone who really cares about seeing the tweet count is surely just in it for the ego boost! :P enjoy!</p>
  
</div>
  


              
            
!

CSS

              
                body {
  background: #f2f2f2;
  color: #555;
}
p {
    line-height: 1.6;
}
.container {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}
.custom-tweet-button,
.custom-follow-button {
  width: 200px;
  margin: 1em auto 2em;
}  
.custom-tweet-button a,
.custom-follow-button a {
  position: relative;
  display: inline-block;
  height: 16px;
  padding: 2px;
  border: 1px solid #ccc;
  font-size: 11px;
  color: #333;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  font-weight: bold;
  background-color: #F8F8F8;
  background-image: -webkit-gradient(linear,left top,left     bottom,from(#FFF),to(#DEDEDE));
  background-image: -moz-linear-gradient(top,#FFF,#DEDEDE);
  background-image: -o-linear-gradient(top,#FFF,#DEDEDE);
  background-image: -ms-linear-gradient(top,#FFF,#DEDEDE);
  border: #CCC solid 1px;
  -moz-border-radius: 3px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
}
.custom-tweet-button a:hover,
.custom-follow-button a:hover  {
  border-color: #BBB;
  background-color: #F8F8F8;
  background-image: -webkit-gradient(linear,left top,left bottom,from(#F8F8F8),to(#D9D9D9));
  background-image: -moz-linear-gradient(top,#F8F8F8,#D9D9D9);
  background-image: -o-linear-gradient(top,#F8F8F8,#D9D9D9);
  background-image: -ms-linear-gradient(top,#F8F8F8,#D9D9D9);
  background-image: linear-gradient(top,#F8F8F8,#D9D9D9);
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
}
.custom-tweet-button a .btn-icon,
.custom-follow-button a .btn-icon{
  position: absolute;
  width: 16px;
  height: 13px;
  top: 50%;
  left: 3px;
  margin-top: -6px;
  background: url('https://twitter.com/favicons/favicon.ico') 1px center no-repeat;
  background-size: 13px;
}
.custom-tweet-button a .btn-text,
.custom-follow-button a .btn-text{
  display: inline-block;
  padding: 2px 3px 0 20px;
}
              
            
!

JS

              
                
              
            
!
999px

Console