Types of Fonts
In the last lesson we introduced you to the basics of working with fonts in CSS. In this lesson we continue in that path as we explore the basic font families and how to render them with CSS.
Video Transcript
00:00We're still we're still talking about fonts, but I want to take a deeper look into the font itself and really font families in general
00:08And there's a few common ones
00:09We're gonna get familiar with all of them and you're gonna know how to have a default font based on a type of font that you need
00:16So we're gonna see that you'll understand a lot more about how fonts work by the end of this lecture
00:21So let's jump right into it
00:24Alrighty, so let's take a deeper look into fonts and understand
00:27How do they work now the most I'm just gonna go through the different types of font options
00:33And we're really talking now about font families when we're not really embedding a font and we just want to tell the browser
00:40This is the font family that we're interested in now in general
00:45We don't have to embed a font so I could go ahead and say hey by the way
00:48I want you to embed the font type of types new Roman, but what if the user doesn't have that type of font?
00:58What would happen what would happen is they would just get the default font that is available to them
01:02We don't have any control further than that in this case
01:05so if I go ahead and just click on refresh, we'll see that now the font that we're getting here is
01:10Really just whatever font that is coming here that we don't really have any control over now if I go ahead here, and I just
01:18Inspect this element it really depends purely on do I actually have that font so in this case?
01:25Is that the font that I was working on is that the area yes? I'm in my span itself
01:30So I want to go into the span itself
01:32Let's inspect that span
01:35Inspect that span we see that we have your times new Roman
01:37And that is that is the font that we're rendering but in the reality what we really want to make sure is that if we
01:44Don't have that font that will have a backup plan now to do that
01:48I could go ahead and put a comma and put other fonts that I would like to position just
01:53Separate them with a comma and with that comma I can then go ahead and define
01:57What other file would I want to have there so let's go ahead and just for the sake before we put those commas
02:04I'm just gonna go ahead and describe the serif font the serif font and I want to go through it's a font family
02:10It's not a specific font in every language
02:12It could be a completely different font in every operating system
02:15It could be represented by a completely different font your browser by default will bring you a font that is serif
02:22If you ask for a serif, it's gonna bring you the default or the available serif one. What is actually serif?
02:28So our serif font is basically it has finishing strokes or flares
02:33It has a taper off in the ending of the font
02:36So if we look at it, and I'm just gonna go ahead here what I want to do is
02:39I'm gonna go ahead and even set this to our
02:42Paragraph so we could have much more vivid look at this
02:45So I'm just gonna go ahead into our article and I'm just gonna go ahead and just set it to be the font family serif
02:51Now when we look at it, and I'm just gonna go ahead and any one of those that which was the font default that we had
02:57There you'll see that our fonts have basically decorations at their ending
03:01There's like a little bit of more information in the L, and there's a little bit of more
03:06extra beauty kind of engaged into it
03:09Contrary to that then that's basically that font family and there's many fun
03:12We don't have complete control over what font would be there because we're just saying hey bring me a font from this family
03:17Now the the width and height of the characters is really defined based on that need of that character
03:23So if O takes this amount of space, and I will take a lot less because it just doesn't need as much space
03:30Okay, so same applies O2 to the font type which is called sans
03:36Serif now the sans serif type there's the only difference or the big difference between a sans serif and font and a
03:43Nonsense their font is it sans serif fonts, and I don't see that it actually changed
03:49So I'm just gonna go ahead here and just save it and click on refresh
03:55and let me check if I have your sans serif and
04:03We could see in our font family if we could find it inside of our paragraph here. Where is our font family?
04:10I don't see our font family and
04:13We don't have no font family even though I asked for it
04:18What's going on?
04:19All right, but let me let me just continue in the the descriptive description that I was talking about a sans serif font
04:27Contrary to a serif font doesn't have those decorations. That's really the big difference between a serif
04:33Oh, I put your equal by mistake a sans serif and a serif font so here we go
04:38So now it updated I made a mistake you're gonna put it equal instead of a dash so sans serif
04:43That was my mistake. You can see that there's no extra decorations of very clean lines now
04:49It could be a completely different font depending on your language operating system and so on and so forth
04:53But fonts that are sans serif are fonts that don't have extra decorations or they're right there. They're the font itself. They're
05:01Very minimalistic you might say
05:03Again, if I have a eye it's gonna take less space than an O or an L or larger characters by default now
05:11Let's move on to the next one, which is called cursive now cursive fonts
05:16And if I'm gonna go ahead here and just type your cursive
05:20Cursive fonts contrary to all the rest or not contrary are not print so they're fonts that are more
05:27Decorative they tend to extend they tend to be scribbled some
05:32You might in your case you might see the letters even connecting to each other
05:36Languages like Arabic are just by nature cursive because the each of that character is connected to the next by nature
05:43But in this case, it's more it feels more written
05:45We don't really know what font that would be again because it really just depends on our operating system
05:49It depends on many other factors because we're not actually defining an explicit character, but we're defining a character family
05:56So we're basically asking the browser. Hey, give me whatever
05:58cursive
06:00Right-option do you have now? The next one is fantasy and fantasy is basically almost non
06:07Characteristic it's been really really decorative. It's main purpose is to make it really pretty
06:13And and really in those scenarios is really you know in many ways when you're trying to make something really pretty
06:17You probably would go to a font that you're really controlling. It's very decorative. It's not
06:24It's you know, and it could be anything in this case. It's very red and legible, but it is incredibly
06:31Stylish decorative and really you would use something like that as a default backup in case you're really decorative font
06:36For some reason did not load or the user doesn't have it if he didn't embed it if he decided not to embed a font
06:42Like we did in a really early chapter when we were embedding the fonts for the Google fonts
06:48Alright, so we've seen fantasy. There's just one more left, which is called mono space and mono space as the name
06:54Suggests is a font that basically every single character has the same spacing
06:59So for example, I takes the same amount of space as a P takes making sure that there's basically complete equality between the
07:07characters this is very common with a top typewriter because typewriters didn't have the capability of
07:13Having less space for an eye versus more space or whatever. It's a very it's more historic
07:18it is also very legible in general and and and that are your those are your
07:24Your types really of characters that you would be playing with
07:27I'll make sure that I'll leave a small little description of the different types
07:32but in general for example, if I wanted to have or a
07:36Specific I such as I know that I like new courier or I want courier and I want courier because it's a I just like it
07:44So I'm gonna put here, you know, I want it to be new courier actually
07:47but if I don't have new courier then I'll set their courier and if I don't have courier then I'll go for the
07:54default and really that is the structure that you would go for especially in scenarios when you're not working with
08:01Embedded font now in this case also by the way
08:04I would probably want to set it maybe in the beginning from setting it for everything unless I'm setting it only two paragraphs again
08:10Just like all the other rules that we talked about previously
08:12You want to minimize your footprint as much as you can whenever you can now
08:17I just want to wrap up talking about minimizing our footprint. I want to talk about our options of actually
08:23Condensing all these rules together into the font rule now
08:27The structure is really one after each other if you miss something then it's fine
08:31It's optional, but it's not it is important the order because sometimes there are some that have the same values
08:38So in this case if I wanted to set it to be oblique
08:40I would literally just go ahead and set my font to be oblique. I would set small caps
08:44I would set the weightness to be the weightness that I defined it. So I would set it to be 800
08:50I want to set my font size, so I would set it to 1em if I wanted to define the height as well
08:57Contrary to all the rest where I just put here a space what I want to do is I would put here a slash
09:033 because these are interchangeable and this is not
09:06Mandatory and I would go ahead and put a comma
09:09Knock on my put another space and I would put my serif and this way I basically captured all the different options in my
09:16Item and I could go ahead here and comment all this out, but I won't
09:20I'm just gonna delete it for a second and return it once we see that everything is still
09:24Presenting itself the way it was presenting before so if I click your refresh
09:27We'll see that it's exact same thing and I could go back and return what we had there
09:32and I'll just comment this out just so you have it as a reference as
09:36a beautiful reference to how you could have done all of that very shortly and that wraps up our
09:42Conversation about fonts usage in general and we're ready to move on to the next topic
