Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
This course focuses on the theories behind web fonts: what makes a good font, why different fonts look the way they do, and how fonts affect the look of a web page. Author Laura Franz covers common tasks, including downloading a font from an online source such as Typekit or Font Squirrel, implementing the font in HTML and CSS, and changing the size and line-height to improve the readability of text. The course also covers different periods of type design and explores the history behind handwritten fonts, text fonts (used for large amounts of text), and display fonts (used for headlines).
Another way to use two fonts on a page is to integrate them more. Instead of choosing to use one font for the headlines and another for the text, try using both fonts for text. The trick is to identify different kinds of information on the page, then use one font for one kind of information and the second font for another kind of information. We're going to do that in this lesson using PT Serif and PT Sans. The two were designed to work together so we know we've got a great pair. For the rest of this lesson, I'm going to show you how I made decisions about integrating PT Serif and PT Sans on the page.
If you'd like, you can sit back and watch. If you want to follow along in the CSS, you can. I've made a copy of the PT Serif file we've made earlier in the course and I've named it pt_serif_sans_tk_site.html. It's available in the Exercise Files for this lesson. Open that up in your text editor. I want to show you the changes that I make along the way. You'll notice I've already included the PT Serif and PT Sans fonts, but I want to point out that this Typekit code won't work for your file.
This embed code is from my Typekit account and works on my server. So you need to put PT Serif and PT Sans in your Typekit, publish it, copy and paste your embed code into this HTML document and upload it to your server. When you're all done, meet me back here. Now that your Typekit is all set, let's scroll down and take a look at this document. The PT Serif is in the universal selector which isn't surprising because we used the original PT Serif file for this file.
I've only added PT Sans all the way down at the end to an a so all of my links will be in PT Sans. Let's take a look at that in the browser. So we can see in the browser that everything is PT Serif except for the links are Sans. I did this because when I looked at this page, I thought the links are very business-like and official. They are for things like paying your taxes online and reporting a pothole. So I thought the Sans Serif font could work better there, whereas the articles are a little bit more human interest where one could go and have a nice dinner perhaps.
So I thought the Serif font would work better with the text in the articles. But there's a slight problem, since everything is Serif in this area of the page and only the links are Sans, the two don't feel integrated. It feels more like we were doing in the last lesson using one font for one purpose and another font for the other purpose and they're not integrated. The only place they start to feel integrated is here where we have a Serif heading with Sans Serif links, and I'd like to create more of that integration.
So I made a copy of this file and let me show you what I did. In the CSS, I made the h4 a PT Sans and then I also specified that any of the P-tags used in the news container, which is our right-hand container, should be PT Sans, and then I also set that any of the line items in that news container should also be PT Sans, and I made sure the acronym are PT Sans. So I'm bringing some more PT Sans into the file.
I did this because I wanted to bring that Sans Serif into the page more, but I really wanted to keep the text in these articles as the Serif because, again, those are our human interest stories. Now looking at this, there is one slight problem and I think it's just that here, the heading looks very nice with these events here, but the heading, the h4 is looking a little bit small compared to the Serif. I think our Sans Serif has a tiny bit smaller x-height than our Serif does. So our Sans Serif is looking a little small.
So I want to bump those up. Now these are on h4, but I don't want to bump up both h4's, only the one here. So let me show you what I did. In the next version, I said that any of the h4s in my content container, which is my middle column, should be a little bit bigger. You can see here there is 17 pixel on 17 instead of 16 on 16. Let's take a look at how that worked out in version 3 here. That works much better. Now this heading is a little bit larger and it works better with this Serif font and this one is a little bit smaller and works better with the Sans Serif font.
Now usually when I work in print, I try to find a perfect size for the headings that would be our h4 headings here and use it everywhere on the page. But unfortunately, when we're working on the Web, we can't use half pixels. I couldn't find a perfect middle size for those. So we're using two slightly different sizes and that's okay. It's much more important that we keep the hierarchy of the page and we help people read the page than it is to follow a rule. One other thing here, we've started integrating the type but I think we could integrate it a little bit more.
What I'd like to do is bring in a little bit more Serif over into this right-hand column, I think a great place to do it would be here, in the quote because while the quote is a slightly different kind of information than the other text in that column and so it won't feel out of place if it's set differently from the rest of the text in the right-hand column. So we're going to go and make that Serif and then up here, in our main heading, it's all Serif. I'm thinking, well, why can't I bring some Sans Serif in there as well? So I'm going to bring in a Sans Serif for Welcome to.
I'm interested in doing that. I think the Sans Serif will hold up really nicely at that small size and I enjoy the Serif font large. So I've decided to do it that way but if you'd prefer to do the small type in Serif and the large type in Sans Serif that would work fine as well. So let's take a look at the next CSS file that I had created. You can see that I've changed the Welcome to PT Sans and I've kept it at the same size. And down here, I changed the quote to PT Serif. So let's take a look at how that works.
Now we're in the fourth version of this file and that's looking much better. We're really starting to see here we have Serif, Sans Serif, Serif, Sans Serif, Serif. So these fonts are really integrated along the right-hand column and it's a nice, lovely integration up here at the top as well. I'm only noticing one last thing and this is related to how information is chunked. I feel like these lines here; the Date, Time and Place feel a little bit loose. I'd like them to feel a little bit more cohesive. So let's go and take a look at the last thing I did in our CSS.
For that right-hand column, the news container for both the P element, I changed the line height to 21 pixels and I did the same in the line item element in that same container. Let's take a look at that. That's much nicer. Comparing it back to the original version, when only the links were Sans Serif, let's take a look at that, the page just feels a little flatter. I think having two fonts helps slightly differentiate the different kinds of information and it gives the page a subtle depth. And here, let's take a look at what I mean.
If we pay attention to the Save the Date area, where we go from Serif to Sans Serif in two different weights to a Serif, keep your eye on that while I pop back over to our original version, and you can just see there's a nice subtle depth, just sort of layers of information there. Integrating fonts this way has its own challenges. It would be easy for this page to get chaotic and each font has four weights and styles so we have eight to work with. I was careful to use a system; the h1, h2, and h3 are all set in the PT Serif and the h4 is a PT Sans Serif Bold.
I made one slight change to the h4; it's a little bit bigger in my center column. But otherwise, they are the same. Plus, all the text in the center column is Serif while all the text in the right-hand column, except the quote, is Sans Serif. I've provided a final version of this page in the Exercise Files, so you can see the final CSS styling if you'd like. When you're mixing and matching fonts, try doing so with a thoughtful system. If you find a page you're working on is getting too complex, try backing up and getting the page to work in just one font.
Then you can add the second font in, like we did in this lesson, adding the PT Sans to the existing PT Serif page.
There are currently no FAQs about Choosing and Using Web Fonts.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.