Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Zocial CSS3 button set and vector icons with @font-face as a Sass mixin and usable as a Compass extension

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 stylesheets
Octocat-spinner-32 templates
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.mdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 zocial.gemspec
README.mdown

Zocial, CSS3 button set and vector icons with @font-face

HUGE thanks to Sam Collins for all his hard work on the original CSS3 button set and the Zocial icons font! Without his work, this project would not exist.

You can find the CSS only version (no Sass) and the full font set at zocial.smcllns.com. This project comes with a free subset of that font set, and includes:

  • Twitter
  • Facebook
  • Google+
  • GitHub
  • RSS
  • Smashing Magazine

Installation

The first step is to install the Ruby gem. If you are not yet setup to work with Sass and Compass, please see the getting started guide at The Sass Way.

(sudo) gem install zocial

Next, we need to require Zocial in the Compass config file of your project.

require 'zocial'

Next is a very crucial step ... getting the fonts installed to your project. This is the step you'll get hung up on if you didn't do the previous steps. Head back to the terminal and run this command from the root of the project you're installing Zocial to.

# execute at the root of your project
compass install zocial/fonts

You should see something like this:

-> % compass install zocial/fonts
directory fonts/zocial/ 
  create fonts/zocial/zocial-lite-regular-webfont.eot
  create fonts/zocial/zocial-lite-regular-webfont.svg
  create fonts/zocial/zocial-lite-regular-webfont.ttf
  create fonts/zocial/zocial-lite-regular-webfont.woff

Once you've done this, your project will be ready to use Zocial! The next step is to "mixin" Zocial which is covered in the usage section.

Usage

Zocial Buttons is delivered with a few default variables in place you can override to fine tune Zocial for your project.

// Defaults
$zocial-font-size: 1.8em
$zocial-icon-font: zocial-lite
$zocial-text-font: helvetica

Based on the default variables, you can change out $zocial-icon-font to just zocial if you own the full set. Keep in mind that if you use the full set, you are still bound by the license terms of the full set even though this framework is open source.

You can also set the $zocial-font-size to something larger or smaller than the default of 1.8em.

Last but not least, you can set the $zocial-text-font to something other than Helvetica. The font family choices are listed below. In a future release, we plan to work on adding better options for using other fonts. Please be patient.

HTML Markup

Here's a snippet of example HTML markup in both HTML and Haml. The caveat or gotcha that most people stumble over is the required nested <span> element. As you can see, each Zocial button gets the required .zocial class name plus the button name.

<button class="zocial icon twitter">
  <span>Sign in with Twitter</span>
</button>
<a class="zocial icon twitter" href="#">
  <span>Sign in with Twitter</span>
</a>

%button.zocial.icon.twitter
  %span Sign in with Twitter
%a(href="#" class="zocial icon twitter")
  %span Sign in with Twitter

To use just the icon version of the Zocial button, all you need to do is add the class name .icon to the above markup. Here's is the repeated code, but this time adding the .icon class.

<button class="zocial twitter">
  <span>Sign in with Twitter</span>
</button>
<a class="zocial twitter" href="#">
  <span>Sign in with Twitter</span>
</a>

%button.zocial.icon.twitter
  %span Sign in with Twitter
%a(href="#" class="zocial icon twitter")
  %span Sign in with Twitter

Buttons classes

The examples shown above illustrate how to use the Twitter Zocial button. Below are the full class options for the named buttons.

  • .twitter
  • .facebook
  • .googleplus
  • .github
  • .rss
  • .smashingmag

Font Family Choices

Icon font:

  • zocial-lite

Text font:

  • helvetica
  • arial (alias to helvetica)
  • lucida-grande
  • lucida (alias to lucida-grande)
  • tahoma
  • times
  • georgia

License

Copyright (c) 2011 Sam Collins (@smcllns) and Adam Stacoviak (@adamstac)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.