Changing Fonts In A Joomla Template

Something I’m asked quite often is how to change the font on a Joomla site. I thought I’d write a quick post about it because it’s an easy thing to do, but there are also some limitations. There’s also one other option for using cool typefaces on your Joomla site which I’ll touch on at the end – It’s called sIFR and uses flash and JavaScript to display a custom typeface. sIFR is really just good for headings as large blocks of type should not be rendered with flash.

Before we delve into how to make the changes it’s important to understand how fonts are displayed. Fonts in web pages are not embedded into the web page itself as many people think. The font must be on the end users computer to be displayed. The way it works is the template designer (or web site designer) will enter the font(s) they want to be displayed but it must be on the visitors computer to work.

This is why pretty much all web sites use one of the 10 or so standard fonts that are available on pretty much all computers – they include Ariel, Verdana, Times, Courier, Tahoma, Georgia, and a few others.

Quite simply all you need to do to change the font in your Joomla Template is edit the font list in your template css file. The css file is in your template folder on your live site – It is usually in a directory called “css” inside the template directory:

yoursite.com/templates/your_template_name/css/template.css

But, this depends on the designer who built your template as it’s not mandatory to structure files like this. It is good practice however and if you got your template from JoomlaBear then this is where you’ll find it.

  • If you are using Joomla 1.0+ then your main template css file should be called template_css.css.
  • If you are using Joomla 1.5+ your template css file should be named template.css

The simplest way to edit this css file is to do it through the Joomla admin. Joomla provides a nice method to access both your template index.php and template css file from the template manager.

  • In Joomla 1.0 go to Site > Template Manager > Site Templates -Then select the template you are using from the list by clicking the radio button and hit Edit CSS.
  • In Joomla 1.5 go to Extensions > Template Manager -Then select the template you are using from the list by clicking the radio button and hit Edit from the top menu. On the next screen hit the Edit CSS button at the top right of screen.

Depending on how the designer structured the CSS file you may need to change font specifications in a number of places inside the template css – especially if you want to change heading styles. Typically the base font will be declared in the body tag like this:

body {
	font-family: Verdana, Arial, sans-serif;
	font-size: 12px;
	color: #CCCCCC;
	line-height:20px;
	background-color: #222222;
}

You can see in the example above that we have two fonts declared – Verdana and Arial – in this example the viewer of your site will see Verdana if they have it installed, and if not the viewers computer will try to use Arial – remember these fonts must be installed on the users computer to be seen on the web page. If Verdana and Arial were not available then the viewers computer would try to use any available sans-serif font installed. Neat eh!

Other common font-family combinations include:

font-family: Arial, Helvetica, sans-serif;
font-family: "Times New Roman", Times, serif;
font-family: Geneva, Arial, Helvetica, sans-serif;

And you can mix and match these as much as you like!

Sans-serif fonts are the straight and simple ones like Verdana and Arial – Serif fonts, like Times and Times New Roman. are the ones with little curly or pointy bits. An interesting fact is that sans-serif fonts are typically much easier to read on screen while serif fonts are easier to read in print! Have a look at any novel and you’ll see what I mean. However this is not true when the fonts are displayed at larger sizes so my recommendation is to go with a simple sans-serif font like verdana or arial for the body text and have fun with type faces like Trebuchet MS, Times, Tahoma, etc for your headings.

If you want to edit the heading font in your template css it will be exactly the same as above except you will need to locate the style in the css – you can do a quick “find” and search for “font-family” – if you whip through all instances of this you will find the heading styles pretty quickly. Or with Joomla you can be quite confident that your heading styles will be contained in one of the following styles:

h1
h2
h3
.componentheading
.contentheading

These are the default classes used for headings.

Hopefully this has been helpful – If you really, really want other typefaces in your template you can look at sIFR, which stands for Scalable Inman Flash Replacement. sIFR uses flash, css and javascript to replace blocks of text on your site. Its a cunning technique that I’ll be delving into further on this blog and using in some our fine Joomla Templates. Stay tuned.

15 Responses to “Changing Fonts In A Joomla Template”

  1. I’d like to add that you could also use courier new font (it’s included in every microsoft word copy). It’s a large type of font that is not only easy to read but is designed to be read on a computer screen.

    It’s easy on the eyes and it looks similiar to newspaper or legal print. Most people have difficulty or lack a desire to read print or text if it isn’t large and spacious (but obviously nothing ridiculous like 20 point font for example). Georgia also works too.

    If you own a website or blog (which most people probably do if they are reading this) consider setting the default font first to courier new or georgia (every computer *should* have courier new and georgia) so you can encourage more people to read what you are writing.

  2. BigBear says:

    Nice typography tips! I’ll definitely look at Courier – I saw it in use somewhere recently and thought it looked good!
    I’m drinking a glass of Australian Shiraz right now and thought I’d take a quick peak at Interactive Wine. Couldn’t see any tasting tips though!

  3. ACT Test says:

    thanks for the details on where to find the font information in the joomla css files (and for the reminder on how the font families work). need to test this on some of our sites… very helpful

  4. Nice tip, thank you.

  5. Gies Pluim says:

    Your article was (is) very helpful. But there are so many items in the css-ses that I have to try things bit for bit to see what I had changed.
    Thank you very much

    Gies Pluim
    Avery old Dutchman (81)

  6. Mandy says:

    This seems to work for most of the site, except in specific components eg, VirtueMart, Contacts and JEvents (these are the ones giving me problems). Would anyone have an idea where, if it’s possible, I would go to change these fonts so that they match the rest of my site?

  7. BigBear says:

    Mandy I will make you a video showing how I go about identifying troublesome CSS – give me a couple of hours.

  8. BigBear says:

    Mandy a quick vid is up for you here

  9. mandy says:

    Thank you sooo much.

  10. bryan says:

    Thank you so much for the tip.. God bless

  11. Joe says:

    I think not embedding the font information in the website and requiring it to be installed on the users computer is lame. There are so many beautiful fonts out there and to be restricted to the 10 major fonts dooms all the joomla websites to having a very similar look. Now who in marketing wants that?

  12. BigBear says:

    That’s a good point Joe, and you’ve reminded me I need to update this article – however the embedded font trick doesn’t work for all browsers and this has nothing to do with Joomla. A snippet I found somewhere:

    CSS3 (and even drafts of CSS2 in 1997 and 1998) have long promised a standardized way of font embedding, using the @font-face rule. What many folks probably don’t know is that this rule is already supported in Opera 9.5, shipping versions of Safari for the Mac, Windows and iPhone OS, and is promised for Firefox 3.1., and well as IE6 and later.

    Sadly, while support for @font-face was hinted at for Opera 9.5 and Firefox 3.1 (see my comments at #4 below) this is in fact not the case sadly.

    There is a catch though. All the browsers other than IE support linking to TrueType font files. Microsoft supports only the proprietary EOT file format.

  13. Joe says:

    On another matter. Oh My God! This is scary! Courier was the typeface that was used on typewriters. Oh My God, how old am I. These people expounding courier probably don’t even know what a typewriter is. It was probably 30 years ago when Apple came out with postcript typefaces. Holy shit, freedom from a typeface where every character took up the same amount of space. Oh My God, now people are returning to Courier thinking how great it is just because they have never seen it before. There is a reason for that…it is about the ugliest typeface ever made.

  14. BigBear says:

    Joe,
    You made me chuckle, thanks for that ;-)

  15. Serge says:

    I am building a site with JA_Purity customised. I want to change the title font to serif (it is Arial and so on in the original template). However, I hesitate because the title fonts listed include “Segoe UI”, Arial, Helvetica, sans-serif;
    Is it safe to change this to serif? Also, I only want to change to serif for the bigger headlines but the template lists h1, h2, h3, h4. What will happen if I removed h3 and h4 from the sizes I want to change to serif? How do I switch to serif just for h1 and h2? Many thanks in advance!

Leave a Reply

 
JOOMLA TEMPLATES Joomla Templates By JoomlaBear