Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
CSS gives Web designers control over the appearance of their web sites by separating the visual presentation from the content. It lets them easily make minor changes to a site or perform a complete overhaul of the design. In CSS Web Site Design, instructor and leading industry expert Eric Meyer reviews the essentials of CSS, including selectors, the cascade, and inheritance. The training also covers how to build effective navigation, how to lay out pages, and how to work with typography, colors, backgrounds, and white space. Using a project-based approach, Eric walks through the process of creating a Web page, while teaching the essentials of CSS along the way. By the end of the training, viewers will have the tools to master professional site design. Exercise files accompany the training videos.
So what we're going to look at in this video is font families, how to use font family to substitute the font-face that is used Uh, font family, font face, what's the difference? Well, let's take a look. So, for our headings, we're going to say font-family Verdana, and if you look at the headings like about tea history or The Legendary Origins of Tea, or Tea of the Day or the Post Archive, when we reload now they're using Verdana.
What happens there, technically is that the browser says ok, I'm going to use Verdana for the font-family, so I'm going to pick the appropriate face from within that font-family, a font-family being a collection of font-faces. So there might be Verdana regular and Verdana bold and Verdana italic and Verdana bold-italic, all those sorts of things. In this case we've just said font family Verdana, we haven't set necessarily anything to be bold or italic. We surely haven't set any italics so the browser's going to say ok, this is the particular font-family that I need to look for a face in and that's how we end up with this various Verdana x text.
Now, you don't have to just say use this font family or nothing else, in the fact that's sort of discouraged, your able to provide a comma separated lists so I say Verdana is our first choice and then if you don't have Verdana, ok you can use Arial and if you don't have Arial then you're going to use Helvetica and if you don't have any of those for some reason, if by some bizarre quirk of fate you have a computer running your web browser or any computer that has neither Verdana nor Arial nor Helvetica then would you please at least use some sans-serif font that you have available. And the difference between serif and sans-serif fonts again, you could find a typography geek who could wax rhapsodical about this particular bit for probably hours on end, but what this comes down to is thing like Verdana and Arial if you look at the text in the headings has fairly basic letterforms, they have strong sort of lines. And they don't have, if you look at the main text underneath The Legendary Origins of Tea, they don't have little things that stick out to the sides or the bottom of the center on the key or the way that the the center on a Y has a little sort of knob on the end and the lowercase a has a little tail that extends out, those are serifs.
And so the, those fonts that have those are called serif fonts, fonts that don't have those are called sans-serif fonts. And again, if you play this for somebody who is a real expert in typography they're going to tear their hair out and mutter about people talking about these things when they don't know what they're talking about and I admit, I'm not an expert, but that's the basic difference and usually just with a little practice you can usually spot the difference between a serif and a sans-serif font pretty easily. Maybe it's like art, I know it when I see it, at any rate.
What we can do is we can select from a number of different font-families. There's one thing you want to watch out for, if you have a font-family whose name has a space in it, like Courier New, is generally a best practice to put that in quotes. You can use single quotes or double as long as you're consistent, put two double quotes around it or you can put two single quotes around it, but either way is a Courier New, and Courier is a monospace font.
So, I've said in the sidebar paragraphs should use Courier New for their font-family and if Courier New is not available and then use some kind of monospace font and there it shows up in a monospace font. Monospace meaning every letter takes up the same amount of horizontal space, a lowercase I takes up the same amount of horizontal space as a lowercase M, whereas if you look at the text on the rest of the page, both the serif and the sans-serif, those are one of those proportional fonts where a lowercase i takes up a lot less horizontal space than an uppercase m for example. So, monospace fonts, it's kind of like using a typewriter for those of you who remember what typewriters are, every character takes up the same amount of horizontal space.
So that's monospace font, not necessarily the greatest visual effect ever, but it's something you can do there. Now the generic font families, serif, sans-serif, monospace, it's suggested that those always go with the end of your font-family list. There are two other generic families besides sans-serif and monospace and they get used very rarely. There is a font-family Cursive, there's also one called Fantasy so you can say font-family fantasy and I would pretty much have the browser pick any random font that does not fall into the other 4 categories and use that for display and there's just no way to predict ahead of time what is going to happened.
That's a Fantasy font according to this browser in this computer. But if I switch it to Cursive I get a Cursive font. There are a few problems here. The are no Cursive fonts at the moment, there are common to all browsers in all operating systems. With sans-serif fonts, Verdana and Arial are fairly widespread. You can find them in almost any computer no matter what operating system is running In the serif realm Times, Times New Roman and variances those are very common.
You can find those on Windows machines, on Macs, on Linux machines Oftentimes. So there, you have those but when it comes to these as Cursive and Fantasy, there's just nothing that's cross platform. There are a number of reasons for this most of historical. When Microsoft created some web fonts for free distribution in the mid-to-late 90s they were all serif, sans-serif and monospace. And so these got installed all over the place and things like Verdana, thank you Microsoft for Verdana, but on the other hand Microsoft did not in that package include Cursive or Fantasy fonts.
So these are very, very rarely used. The thing is of course if a cursive font doesn't exists for whatever reason if the browser just doesn't know of any fonts that can be classified as Cursive, then, in this case it will say well I can't find any Cursive fonts so I'm just going to fall back to whatever my default is. So it's not like you won't get any text it just won't necessarily be Cursive. But here's where it gets even more interesting. So I've set font-family Cursive and font style italic and the way that CSS font structure really works is that for literally every character that's displayed the web browser says okay, this character's supposed to be displayed as an italic Cursive font.
Do I have any cursive fonts that have italic faces or can I somehow generate them. And that's up to each browser to figure out A) does it has the resources on hand and B) if it does not have the right resources on hand, can it generate them? Firefox here might be just taking the italic text that I had and slanting them, just programmatically slanting them so sort of skewing them like you might do in Photoshop. So that's what Firefox does but on the same computer, Safari, it'll do this.
It knows it is supposed to have the cursive font-family in use but it also knows it is supposed to have an italic font used. Alright, so it means it is trying to find a font face somewhere that is both cursive and italic and Safari didn't find one and rather than try to programmatically slant all of the Cursive text it just stops looking for Cursive and it looks for something that is italicized so that it can use and this is what it settled on. Because if I take out font style italic, then I go to Safari there you go, it's italicized.
Safari is not wrong to do what it does. It's simply not consistent with other browsers. Sure it would be nice if they were all completely consistent in every last little detail but let's be honest, in the entire history of there being more than one web browser they were never consistent. There was a time when there were literally to Web browsers in the entire world. They did not do the same things. Browsers have never been consistent and never will be, right now they are far more consistent than they've ever been so at least we'll have that to fall back on. So this is another reason why cursive fonts tend not to be used because of the way font selection works you're never quite sure if just doing something simple like saying hey, I'd like this text also be italicized will cause massive changes in the actual font-face that gets used and Fantasy's even more crazy because with Fantasy well a browser might decide, you know, the only font that I have that even comes close to being Fantasy is Webdings so I'm going to replace all the text with symbols that could qualify as a Fantasy fonts so pretty much serifs, sans-serif and monospace are the only ones you see and honestly you only ever see monospace if someone's publishing code or CSS as the case may be.
So that's something that you do have to watch of four and it is possible for even non-cursive fonts, such as, for serifs and sans-serif fonts to not have the kind of face that you're looking for. So again, if you run into a case where you have a font and then the font goes kind of strange when you do something like italicize it or bold face it or do both at the same time, it could simply be that the browser can't find a font face that's has the particularly combination of effects you want in the font-family you want to use and that's falling back to a different font-family.
So, these sort of obscure details can complicate things, but the basics are very straightforward if you want a font-family you say here's my list of font-families that I'm willing to accept and here's my generic fallback. You know, so for headings Verdana's my first choice, Arial's my second choice, Helvetica's my third choice and if none of those is going to work then at least some sans-serif font should be used, and that's how you do font-families.
There are currently no FAQs about CSS Web Site Design.
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.