Working with web fonts

show more Working with web fonts provides you with in-depth training on Web. Taught by Joseph Lowery as part of the Dreamweaver and WordPress: Core Concepts show less
please wait ...

Working with web fonts

The emergence of web fonts is one of the most far-reaching innovations in web design in recent years. Finally, designers are freed from the stranglehold of just using system fonts. The general Roux Academy site makes use of several web fonts for both headings and body copy. So we'll want our blog to follow suit. Although it's an essential step it's no big deal just copying and pasting a set of files and a chunk of code. You can tell that there is a web font in use, if I click right into this h1 tag, here, and then look over in the Properties Pane, you see font-family Bitter comma Georgia et cetera, Bitter obviously is a web font, and there are others that are in use throughout the site.

So those fonts are stored locally. So I'm going to go ahead an expand the Files panel and locate those in the rest of the site and they're in a folder called _fonts, so I'll just open that up, and you can see there's a quite a bit of them there, Bitter is being used as well as one called DroidSans. Now I want to go ahead and copy this entire folder, so I'm going to select it and then press Command+C, of course on the PC you would choose Ctrl+C. Now we want to take this font folder, and we want to put it in our child theme folder, which is roux.

So let's go down to the wp-content folder, and then within the themes folder locate roux, and I'll just go ahead and expand that, so you can see right now all we have in it is style.css, and then I'm going to use Command+V to paste in my copied fonts. All right. Now let's move into the code. I'll shrink the Files panel. I'm going to go ahead and just go to Code view and make sure you are in main.css. This is for our blog_comp and the rules for web fonts are typically stored at the top of the page, so I'm going to scroll up there, and here you can see the start of them is quite a number of rules, I think there are five in all.

So I am just going to copy all of those, starting with the little comment there, Font declarations, and then ending with the last @ font-face rule for DroidSans. So again, I'll go a Command+C to copy it, and now let's go over, and we'll close up the CSS Styles panel for a second just so I can scroll up and go to my index.php page that's located in the blog folder, I'll open that up, and let's click on Discover.

I'm going to go ahead and click the Don't warn me again, because we're going to be doing this a lot, and there's no need to have to click the Yes button each time. All right. Now I'm going to set the Custom Filter to style.css, click OK, and there's our two style.css sheets. The first one is the one for the roux folder, as you can see, and we want to continue to put our web fonts close to the top.

We'll put it after the import url declaration, so I'll put my cursor at the end and then make a new line and then, Command+V to paste them all in. But since we already have a body rule established which I'll scroll down to, let's go in and add the font-specific declarations. Again, I'm going to go back to my blog_comp. So now I'll scroll down a little bit to where the font declaration is you can find that on line 87 and the declaration we're mostly interested in is the font declaration.

Although we want to go ahead and pick up these other ones as well, so I'm going to go ahead and select all of the declarations in body, copy that, head back over to index.php, put my cursor in the body rule and paste them right in. So I'll save this file, and we're done. Now I can be assured that when I begin to set the styling for various elements on the page my web fonts will be ready to go to work.

Working with web fonts
Video duration: 4m 3s 5h 44m Intermediate Updated Oct 23, 2012


Working with web fonts provides you with in-depth training on Web. Taught by Joseph Lowery as part of the Dreamweaver and WordPress: Core Concepts

Dreamweaver WordPress
please wait ...