<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=http://codepen.io/alistairtweedie/&text=Twitter buttons for mobile - no iframes yay! from @alistairtweedie&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>
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;
}
As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.
Also see: Tab Triggers