0

I want to use the OpenSans-Light.tff webfont that I downloaded off of Google Fonts. Here is what I am trying within my main.css:

@font-face {
    font-family:"OpenSans";
    src: url("fonts/OpenSans-Light.ttf");
}

.banner h1 {
    font-family: "OpanSans", arial;
}

Though it's not working.

Milo
  • 3,365
  • 9
  • 30
  • 44
  • first, it is OPEN, not OPAN. Second, that is not the code provided by Google fonts, not even close – Devin Sep 19 '14 at 03:31

4 Answers4

1

If you want to use just @import use it like this:

@import url(http://fonts.googleapis.com/css?family=Open+Sans);

or add this to your HTML <head>

<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

and then add this to your CSS

.banner h1{font-family: 'Open Sans', sans-serif;}
Devin
  • 7,690
  • 6
  • 39
  • 54
0

The easiest (and arguably best way to do it) is simply use @import in your CSS.

Here's a JSFiddle I made for you: http://jsfiddle.net/gLej4h82/

CSS:

@import url('http://fonts.googleapis.com/css?family=Open+Sans');

body {
    font-family: 'Open Sans';
}
0

If you add

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700,300);

to the very top of your code in your css file and reference it on the certain object like the below it should work

.banner h1{
font-family:'Open Sans', sans serif;
font-weight: 400; /* 400 is regular, 300 is light, 700 is bold */
} 
-1

Use this service to generate the font face for you its very nice service.

http://www.fontsquirrel.com/tools/webfont-generator