Home arrow HTML arrow Page 3 - Google Font API: Using the Bi Shorthand
HTML

Google Font API: Using the Bi Shorthand


In this penultimate part of the series, I take a detailed look at the “bi” shorthand included with the Google Font API. It can be used as a replacement for the “bolditalic” option covered in a previous article. Since the function of the suffix “bi” is nothing but to query the API using a shorter and more compact syntax, its implementation should be extremely straightforward.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
July 06, 2010
TABLE OF CONTENTS:
  1. · Google Font API: Using the Bi Shorthand
  2. · Review: the bolditalic argument
  3. · Introducing the bi shorthand
  4. · Including the CSS styles in an (X)HTML document

print this article
SEARCH DEVARTICLES

Google Font API: Using the Bi Shorthand - Introducing the bi shorthand
(Page 3 of 4 )

As one might expect, the use of the "bi" shorthand is quite similar to working with its counterparts, “i” and “b,” discussed in previous parts of the series. However, even though the theory that surrounds the implementation of the “bi” option is very simple to understand, the best way to illustrate how to use it is by example. So below I coded one that shows how to request in one go the italic and bold versions of the “Cantarell” typeface by using this shorthand:  

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Cantarell:bi|Nobile" />

There you have it. Simply by appending the suffix “bi” to the name of the specified font will effectively download its bold and italicized versions. Once the request has been successfully processed, the font(s) can be used in a standard fashion, as shown below: 

h1 {

    font: normal 46px 'Cantarell', Helvetica, sans-serif;

    color: #00f;  

}

h2 {

    font: normal 40px 'Cantarell', Helvetica, sans-serif;

    color: #ff8040;  

}

h3 {

    font: normal 32px 'Cantarell', Helvetica, sans-serif;

    color: #ff8040;

}

p {

    font: normal 14px 'Nobile', Helvetica, serif;

}

So far, so good. Now that you've grasped the logic behind using the "bi" shorthand, we'll include the previous CSS styles into an (X)HTML document, so you can have at your disposal a working example that will let you see the actual functionality of this shorthand.

This final process will be accomplished in the next section of this tutorial, so leap forward and keep reading.


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials