Design and CSS styles
Version 5.x > Design and CSS styles > Using the Google Font API and Kentico CSS stylesheets? View modes: 
User avatar
Member
Member
arusso-accessgroup - 11/1/2010 10:18:11 AM
   
Using the Google Font API and Kentico CSS stylesheets?
I began using the Google Font API to load in fonts that are not normally available in most web browsers. Using the Google Font API is very simple, you add a link reference to the google api and specify the font you want. For example:

<link href='http://fonts.googleapis.com/css?family=Nobile:regular,bold&subset=latin' rel='stylesheet' type='text/css' />

Then you speciy the font by name in the styles of your CSS stylesheet:

h1, h2, h3, h4 {
font-family: "Nobile", "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", Tahoma, sans-serif;
font-weight: normal;
}

The problem I'm having is that we prefer to use Kentico's stylesheets instead of referencing outside CSS stylesheets for our sites. The stylesheet reference is hard-coded in the Kentico page layout and comes before any extra code you wish to add to the HEAD section. For example:

<html>
<head>
<title>
Client Portal - </title>
<meta http-equiv="pragma" content="no-cache" />
<link type="text/css" rel="stylesheet" href="/KenticoWeb/ClientPortal/CMSPages/GetCSS.aspx?stylesheetname=ClientPortal" />

... followed by textarea of the HEAD section.

I've tried referencing the google link as a URL reference in the stylesheet, but it will not work that way. Has anyone been able to get this work using Kentico stylesheets?






User avatar
Member
Member
arusso-accessgroup - 11/1/2010 10:33:12 AM
   
RE:Using the Google Font API and Kentico CSS stylesheets?
Ah, I had to read a bit further into the Google font api documentation, but this works perfectly well:

@import url(http://fonts.googleapis.com/css?family=Nobile&subset=latin);

I recommend this technique for anyone looking for more fonts thatn the usual arial, helvetica, san-serif, etc.

User avatar
Member
Member
msitar@vivix.ca - 5/25/2011 9:23:07 AM
   
RE:Using the Google Font API and Kentico CSS stylesheets?
This worked for me, what I did was just pasted the following:

@import url(http://fonts.googleapis.com/css?family=Open+Sans:light,regular,regularitalic,bold,bolditalic);

at the top of my css document. Everything works and the fonts load nice. It seems like the Google Font Directory is growing quite a bit.