Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now
Watching:

Enhancing typography with CSS3


From:

HTML5 First Look

with James Williamson

Video: Enhancing typography with CSS3

One of the features of CSS3 that I'm most excited about is its ability to enhance typography and finally add a viable alternative when choosing fonts for our sites. In the past, we've either had to deal with using the same system fonts over and over and over again, all resorting to pretty complicated workarounds like Cufon or sIFR. Now, CSS has allowed us to fake font usage by swapping up background images and text but none of those approaches have even come close to the usability and accessibility of simply declaring a font for the page to use. We'll add font-face as part of the CSS3 specification and it allows authors to reference online fonts and then use them within the author styles.
Expand all | Collapse all
  1. 3m 56s
    1. Welcome
      1m 1s
    2. Using the exercise files
      1m 50s
    3. Who is this course for?
      1m 5s
  2. 21m 12s
    1. Exploring prior standards
      4m 26s
    2. Why do we need HTML5?
      3m 32s
    3. HTML5 timeline
      4m 24s
    4. Current HTML5 support
      4m 25s
    5. What HTML5 is (and what it isn't)
      4m 25s
  3. 27m 49s
    1. HTML5 vs. HTML4
      3m 25s
    2. New structural tags
      6m 1s
    3. New content tags
      4m 7s
    4. New application-focused tags
      5m 32s
    5. Deprecated elements
      4m 28s
    6. API overview
      4m 16s
  4. 22m 28s
    1. Content models
      5m 33s
    2. Understanding the outline algorithm
      3m 21s
    3. The role of ‹div› tags
      4m 19s
    4. Using ID and class attributes
      2m 6s
    5. DOCTYPE declarations
      4m 16s
    6. Character encoding
      2m 53s
  5. 41m 27s
    1. Basic page structure
      3m 40s
    2. Structuring top-level elements
      7m 30s
    3. Structuring interior content
      8m 42s
    4. Building headers
      9m 11s
    5. Checking document outlines
      5m 46s
    6. Ensuring cross-browser structure
      6m 38s
  6. 27m 53s
    1. New input types
      5m 57s
    2. Setting form autofocus
      2m 53s
    3. Using placeholder data
      4m 4s
    4. Marking required fields
      3m 24s
    5. Working with number inputs
      5m 49s
    6. Using date pickers
      5m 46s
  7. 1h 1m
    1. Canvas overview
      6m 21s
    2. Adding canvas content
      8m 58s
    3. Drawing in the canvas environment
      12m 9s
    4. Drag-and-drop API overview
      6m 18s
    5. Offline applications overview
      7m 11s
    6. Video overview
      5m 45s
    7. Encoding video
      8m 23s
    8. Adding video
      5m 58s
  8. 57m 33s
    1. Geolocation API overview
      5m 50s
    2. Web storage API overview
      5m 40s
    3. WebSockets overview
      4m 16s
    4. CSS3 overview
      6m 38s
    5. Enhancing typography with CSS3
      7m 42s
    6. Using @font-face
      7m 11s
    7. Styling HTML5 with CSS3
      10m 23s
    8. Using CSS3 transitions
      9m 53s
  9. 5m 6s
    1. Final thoughts
      3m 49s
    2. Goodbye
      1m 17s

please wait ...
Watch the Online Video Course HTML5 First Look
4h 28m Beginner Aug 23, 2010

Viewers: in countries Watching now:

In HTML5 First Look, author James Williamson introduces the newest HTML specification, providing a high-level overview of HTML5 in its current state, how it differs from HTML 4, the current level of support in various browsers and mobile devices, and how the specification might evolve in the future. Exercise files accompany the course.

Topics include:
  • Understanding the history of HTML5
  • Using new tags
  • Understanding HTML5 semantics
  • Coding ID and class attributes in HTML5
  • Structuring documents
  • Building forms
  • Exploring HTML5 native APIs
  • Encoding and adding HTML5 video
  • Exploring associated technologies such as CSS3
Subjects:
Developer Web
Software:
HTML
Author:
James Williamson

Enhancing typography with CSS3

One of the features of CSS3 that I'm most excited about is its ability to enhance typography and finally add a viable alternative when choosing fonts for our sites. In the past, we've either had to deal with using the same system fonts over and over and over again, all resorting to pretty complicated workarounds like Cufon or sIFR. Now, CSS has allowed us to fake font usage by swapping up background images and text but none of those approaches have even come close to the usability and accessibility of simply declaring a font for the page to use. We'll add font-face as part of the CSS3 specification and it allows authors to reference online fonts and then use them within the author styles.

It's actually been around and supported within browsers for some time, but until recently the issues surrounding font licensing have really prevented any widespread adoption. Now lately, several online font hosting services and a rise in open-source online fonts has led to an increasing number of sites serving custom fonts using @font-face. Now, the syntax is pretty easy to learn. Check it out. So, that's pretty simple. You just say @font-face, then in the font-family property you give the name of the font that you want to reference later on in your code, and then you pass the source where the actual font itself can be found.

So, all that we would have to do after that is reference the name, in this case myFont, in the font-family declarations throughout the site, and then obviously in this sample, I would have the Embedded OpenType, that's EOT file font, on my server. Now, you could also link to another domain or a hosted service as well when you're pointing to the resource. In this case, if I wasn't licensed to distribute that font, I could be in trouble because I'm hosting it on my server. So, you need to be extremely clear on the permissions that you have for any fonts you're going to be using like this.

Okay, as with any new features, there are some support issues across multiple browsers that you need to be aware of. Safari has supported @font -face since version 3.1. Opera versions 10 and above, Internet Explorer since version 4-- No seriously. Since version 4! Firefox since version 3.5 and Chrome since version 4, but here's where it gets a little tricky. @font-face allows for multiple types of fonts to be used and they're not supported in all browsers. Here is what's supported.

Safari supports TrueType fonts and OpenType fonts, although the iPhone or iPad only supports SVG fonts. Internet Explorer only supports Embedded OpenType fonts and Firefox and Chrome supports TrueType and OpenType fonts. Opera supports TrueType, OpenType and SVG. Now the Web Open Font Format or WOFF is a relative newcomer to web font types and currently it's only supported by Firefox. Wow! That certainly muddles things up a bit, doesn't it? Well, the good news is you can modify your syntax to pass more than one font type.

Here's how we do that. Whoa... Hey, what's up with the smiley face? Well, here I'm going to turn to Paul Irish to explain all of this syntax to you. Now, Paul has an excellent blog post about cross-browser font syntax. I encourage you to go check it out. So essentially what we're doing here is we're declaring the font-family as normal, but then it gets a little bit tricky and it's got everything to do with Internet Explorer, which only supports the Embedded OpenType font format. Now, if you went ahead and just declared multiple font types, Internet Explorer will try to download everything else as well and you'd have some problems.

By using this tricky syntax that we're doing, we keep Internet Explorer from choking on the other font formats. Now, other browsers are going to simply keep going until they find a format they can use. So, that's what's up with the smiley face. See the local property tells your computer what the font is named locally, so that if it's already installed on the machine the browser is just going to request it instead. The problem is there's a chance that there might be some font confusion, so you might say Garamond, but their Garamond might look a lot different or it might not even be named the same thing. So the chance for confusion is pretty high.

So to make sure the exact font you want is used, the one you declared in the syntax, Paul passes a value that will not possibly be confused and he uses a smiley face, which is absolutely lovely. Now, the format type that follows that is there just to confuse Internet Explorer. So you'll notice the EOT font is always the first one that shows up in the source and then use the other syntax for everybody else. Okay, so now that you know all of that, let's talk about how to get a few web fonts prepared for our next exercise. Now, due to licensing issues, we did not supply the fonts that we will use in the next example, so they're not in your exercise folders.

So, I want to show you my favorite way to go and get license-free fonts for my web projects, and it's there that we're going to find the fonts that we're using for our next exercise. Now, Font Squirrel, which is fontsquirrel.com, is a fantastic site that's got a large collection of free fonts that you can use in your projects. Even more importantly they have this, the @ font-face Kits, which is where you need to go. So you're going to go to fontsquirrel.com and you're going to click on the @font-face Kits. So, what these are is a list of different fonts and you can see they've got a lot of these guys that not only will you be able to download the font type; you'll be able to download multiple font types and the syntax for cross-browser compliancy.

So these kits are really great way of including these fonts in your sites without having to write a lot of this code yourself or worry about the minutia. Okay, now I'm going to scroll pretty much all the way down there,. Two of these that we need for our exercise. The first one that we need is going to be found -- I keep going here, try not to go too fast-- in the Serif section we're going to find Mido. So, I'm going to go ahead and click the icon here for Get Kit. It's going to prompt me to go ahead and download that, the Mido-fontfacekit.zip.

I'm going to go ahead and do that, and then I'm going to scroll down and in the next section, the Slab Serif, I'm going to find ChunkFive. Now, those are the two fonts that I'm going to use to enhance the typography of the trail guide. Feel free to experiment. If you want to try some of the other ones, by all means go ahead and kind of play around these a little bit. So, I'm going to choose Get Kit on that as well and I'm going to save and download it. Okay, now once you've download these you're going to find a ZIP file. Go ahead and extract the ZIP file and let's talk about what you're going to find inside of this.

So, looking inside of this folder, I can see that I have the Embedded OpenType font, an SVG font, a TrueType, a WOFF and in some cases you're going to have OpenType fonts as well. The font license is included as well. I highly recommend that you read that license before you use these within your projects and there's also a demo page. More importantly, there is a style sheet. If you open up the style sheet, I'm just going to double-click on it, open it up with Dreamweaver but you can open it up with any text editor or HTML editor that you want. You can see that the font-face declaration is already made for me, including the smiley face, because I'll be honest with you, I don't know how to type on the keyboard to get the smiley face.

So you can just copy and paste it, and if you wanted to use another character other than the smiley face you could. It's just one of those things that is kind of cool to do and it ensures that it's going to work properly. Okay, so now we're ready to go and in our next movie we're going to use these fonts to spice up our trail guide page. Now, I need to mention here that @font -face is not the only viable solution for web typography. A quick search online will show many different techniques and libraries designed to make using on your web site easier. For example, Google now hosts a font library which can be accessed through some fairly simple code on your page.

I encourage you to learn as much about @font-face as well as those alternate techniques as you can to determine which of them is right for your projects.

There are currently no FAQs about HTML5 First Look.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed HTML5 First Look.

Return to your organization's learning portal to continue training, or close this page.


OK

Upgrade to View Courses Offline

login

With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts.
lynda.com provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now
 

A trusted source for knowledge.

 

We provide training to more than 4 million people, and our members tell us that lynda.com helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.