Home arrow HTML arrow Page 3 - Using the Google Font API`s Italic Option
HTML

Using the Google Font API`s Italic Option


In this second part of the series, I take an in-depth look at the “italic” option provided by Google’s Font API. It comes in handy for downloading and using the italicized version of a specified font family. The driving logic of this option is very easy to grasp, so you shouldn’t have major trouble using it when styling text-based elements on your own web pages.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 6
June 16, 2010
TABLE OF CONTENTS:
  1. · Using the Google Font API`s Italic Option
  2. · Review: start using the Google Font API
  3. · Working with the italic option
  4. · Including the previous CSS styles in a web page

print this article
SEARCH DEVARTICLES

Using the Google Font API`s Italic Option - Working with the italic option
(Page 3 of 4 )

As I expressed in the section that you just read, the Google Font API gives web designers the option to be more “selective” when requesting a specific font family, as it permits you to download only the italic version of that family via an additional query string option named “italic.”

For instance, say that you need to decorate the text elements of the previous web page with the “Nobile” and “Cantarell” fonts, but only using the italicized version of the latter. In a case like this, the API should be queried in the following way:

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

That was simple to code and read, right? To download only the italic version of a given font, its name must be followed by the “italic” option, separated by a colon (:). Once the fonts have been served from one or multiple Google hosts in the cloud, they can be used to style the selected HTML elements in a classical fashion, as show 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;

}

Even though the above CSS styles look identical to the ones coded in preceding examples, in this case the H1, H2 and H3 elements will be displayed on screen in an italic style, which is the desired result. Naturally, to see how these text elements are rendered by the browser, the styles must be properly coupled to the markup of a web page. That's what I'm going to do in the last section of this tutorial, so you can have at hand a fully-functional example which you can tweak and improve at will.

Now, jump forward and read the upcoming segment.


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