-
AuthorPosts
-
TomC Moderator
TomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 20, 2010 at 6:30 pm #157693USING @FontFace for Non-Traditional/Alternative Fonts On Your Site
I have to give a shout out to Moderator scotty for pointing me in the direction of @FontFace as an alternative to using the cufon method of using alternative fonts.
I am very excited about this method because I was having the damndest time trying to use the
“cufon” method to use a particular font for my main navigation. It DID replace the main nav font, but it also affected the sub-nav menu items in a way I did not want – and I couldn’t figure out how to circumvent the issue . . . UNTIL scotty pointed me in the direction of the @FontFace method.The method is actually VERY simple (so long as you get all the syntax correct in your css code).
Here are a couple of links to explain the process . . .
http://nicewebtype.com/notes/2009/10/30/how-to-use-css-font-face/
http://www.miltonbayer.com/font-face/
http://sixrevisions.com/css/font-face-guide/
FOR A PRACTICAL EXAMPLE OF HOW I USED IT in my JA TEMPLATE . . .First I utilized FontSquirrel’s @FontFace Generator (http://www.fontsquirrel.com/) to generate the @FontFace font files I would need – in my case, “League Gothic” I then created a “fonts” folder (within my template css folder) and uploaded the font files there.
the structure looks like this . . .
– your template
—- css
——- fontsI then inserted the @fontface css code into (in my case) my mega.css file and designated the font for the particular div/class I wanted it to appear, as follows . . .
/* STYLING THE MENU
-----------------------------------*/
/* 1st level */
@font-face {
font-family: 'League Gothic';
src: url("../../css/fonts/League_Gothic.eot") format('eot');
src: local("☺"),
url("../../css/fonts/League_Gothic.otf"),
url("../../css/fonts/League_Gothic-webfont.wof") format('woff'),
url("../../css/fonts/League_Gothic-webfont.ttf") format('truetype'),
url("../../css/fonts/League_Gothic-webfont.svg#webfontpm5EArBj") format('svg');
font-weight: bold;
font-style: normal;
}#ja-mainnav ul.level0 li a {
display: block;
text-decoration: none;
font-size: 30px;
color: #000;
font-weight: 500;
padding-top: 16px;
padding-right: 10px;
padding-bottom: 5px;
padding-left: 0px;
height: 37px;
text-transform: uppercase;
font-family: League Gothic, Helvetica, Arial, sans-serif;
}
You need to make sure you designate the correct path to the fonts (within the fonts folder you created).
I found out, though some trial-and-error” that precise syntax is key.But WHALLA, IT WORKS as it should and now you can use non-traditional/alternative fonts for various parts of your site.
Hope this has been of some use and benefit for you.
🙂
TOM
4 users say Thank You to TomC for this useful post
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
January 6, 2011 at 4:26 pm #370499With more and more “alternative / non-traditional web fonts” being used in templates these days, I’m thinking more of you may want to know about this very easy method to utilize most any font you want . . . . so, BUMP.
🙂
thatcomputerdude Friendthatcomputerdude
- Join date:
- December 2008
- Posts:
- 280
- Downloads:
- 0
- Uploads:
- 9
- Thanks:
- 67
- Thanked:
- 32 times in 1 posts
March 11, 2011 at 3:42 pm #380936I’m having no luck getting this to work with Internet Explorer and basically did exactly what you did.. Have you run into any problems with the font not showing up in Internet Explorer?
Works fine with FF, Safari and Chrome.
thatcomputerdude Friendthatcomputerdude
- Join date:
- December 2008
- Posts:
- 280
- Downloads:
- 0
- Uploads:
- 9
- Thanks:
- 67
- Thanked:
- 32 times in 1 posts
March 11, 2011 at 4:33 pm #380941I figured it out – I had to tweak a line of code for IE, here is my new @font-face code
@font-face {
font-family: 'BebasRegular';
src: url('../../css/fonts/BEBAS___-webfont.eot');
src: url('../../css/fonts/BEBAS___-webfont.eot?iefix') format('eot'),
url('../../css/fonts/BEBAS___-webfont.woff') format('woff'),
url('../../css/fonts/BEBAS___-webfont.ttf') format('truetype'),
url('../../css/fonts/BEBAS___-webfont.svg#webfontSRj8j0PE') format('svg');
font-weight: normal;
font-style: normal;}
irfandi Friendirfandi
- Join date:
- July 2011
- Posts:
- 94
- Downloads:
- 0
- Uploads:
- 42
- Thanks:
- 43
- Thanked:
- 2 times in 1 posts
December 21, 2011 at 2:02 pm #430689TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 21, 2011 at 9:52 pm #430748<em>@irfandi 290491 wrote:</em><blockquote>
the fontsquirrel.com doesn’t work…</blockquote>
I am guessing this is an issue related to your particular browser configurations.
I just brought up the site no problem.1 user says Thank You to TomC for this useful post
dieudonne Frienddieudonne
- Join date:
- January 2011
- Posts:
- 947
- Downloads:
- 61
- Uploads:
- 266
- Thanks:
- 452
- Thanked:
- 107 times in 3 posts
February 5, 2013 at 2:04 pm #482520Thanks.
And can you provide a little tuto : “how to work with font in .less file ?”
It’ll be great.Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
February 6, 2013 at 8:13 am #482646Hi,
Please make your concern about font in Less clearer, how you want to achieve. Here is good reference to know about Less & Bootstrap:
AuthorPostsViewing 8 posts - 1 through 8 (of 8 total)This topic contains 8 replies, has 5 voices, and was last updated by Saguaros 11 years, 9 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
How To Use @FontFace for Alternative Fonts
Viewing 8 posts - 1 through 8 (of 8 total)