Start learning with our library of video tutorials taught by experts. Get started

CSS: Core Concepts

Letter and word spacing


CSS: Core Concepts

with James Williamson

Video: Letter and word spacing

To control the spacing between letters and words in CSS, we use the letter spacing and word spacing properties respectively. Now those of you familiar with print design will recognize letter spacing as tracking, which essentially means adding an equal amount of space between letter pairs. Now true kerning through CSS still eludes us at the moment, but as we'll discuss at the end of this lesson, it shouldn't be much longer until those capabilities are added as well. So for this example, we're going to be using spacing.htm which you can find in the 04_11 folder.
Expand all | Collapse all
  1. 4m 57s
    1. Welcome
    2. Using the exercise files
      4m 2s
  2. 1h 7m
    1. Exploring default styling
      4m 56s
    2. CSS authoring tools
      2m 29s
    3. CSS syntax
      4m 45s
    4. Writing a selector
      4m 10s
    5. Setting properties
      8m 40s
    6. Common units of measurement
      7m 47s
    7. Inline styles
      5m 1s
    8. Embedded styles
      5m 19s
    9. Using external style sheets
      10m 34s
    10. Checking for browser support
      8m 48s
    11. Dealing with browser inconsistencies
      5m 30s
  3. 2h 15m
    1. Structuring HTML correctly
      2m 51s
    2. Element selectors
      4m 52s
    3. Class selectors
      6m 4s
    4. ID selectors
      3m 27s
    5. Using classes and IDs
      10m 7s
    6. Element-specific selectors
      4m 35s
    7. The universal selector
      5m 42s
    8. Grouping selectors
      4m 49s
    9. Descendent selectors
      7m 32s
    10. Child selectors
      5m 7s
    11. Adjacent selectors
      5m 30s
    12. Attribute selectors
      12m 43s
    13. Pseudo-class selectors
      3m 54s
    14. Dynamic pseudo-class selectors
      8m 29s
    15. Structural pseudo-class selectors
      6m 45s
    16. Nth-child selectors
      13m 10s
    17. Pseudo-element selectors
      12m 40s
    18. Targeting page content: Lab
      8m 56s
    19. Targeting page content: Solution
      7m 59s
  4. 42m 39s
    1. What happens when styles conflict?
      4m 0s
    2. Understanding the cascade
      5m 47s
    3. Using inheritance
      6m 11s
    4. Selector specificity
      6m 55s
    5. The !important declaration
      4m 5s
    6. Reducing conflicts through planning
      3m 33s
    7. Resolving conflicts: Lab
      6m 45s
    8. Resolving conflicts: Solution
      5m 23s
  5. 1h 47m
    1. Setting a font family
      7m 10s
    2. Using @font-face
      9m 18s
    3. Setting font size
      7m 35s
    4. Font style and font weight
      6m 52s
    5. Transforming text
      3m 58s
    6. Using text variants
      2m 49s
    7. Text decoration options
      4m 26s
    8. Setting text color
      3m 2s
    9. Writing font shorthand notation
      8m 49s
    10. Controlling text alignment
      6m 33s
    11. Letter and word spacing
      9m 11s
    12. Indenting text
      4m 30s
    13. Adjusting paragraph line height
      10m 30s
    14. Controlling the space between elements
      6m 41s
    15. Basic text formatting: Lab
      8m 45s
    16. Basic text formatting: Solution
      7m 14s
  6. 2h 1m
    1. Understanding the box model
      16m 53s
    2. Controlling element spacing
      14m 29s
    3. Controlling interior spacing
      10m 49s
    4. Margin and padding shorthand notation
      6m 27s
    5. Adding borders
      8m 57s
    6. Defining element size
      10m 7s
    7. Creating rounded corners
      6m 58s
    8. Background properties
      2m 51s
    9. Using background images
      5m 10s
    10. Controlling image positioning
      10m 25s
    11. Using multiple backgrounds
      7m 5s
    12. Background shorthand notation
      5m 25s
    13. Styling container elements: Lab
      7m 55s
    14. Styling container elements: Solution
      8m 17s
  7. 47m 51s
    1. Color keyword definitions
      5m 4s
    2. Understanding hexadecimal notation
      6m 5s
    3. Using RGB values
      4m 58s
    4. Using HSL values
      5m 17s
    5. Working with opacity
      2m 23s
    6. Using RGBa and HSLa
      3m 8s
    7. Styling drop shadows
      5m 38s
    8. CSS gradients
      6m 32s
    9. Working with color: Lab
      4m 26s
    10. Working with color: Solution
      4m 20s
  8. 1m 58s
    1. Additional resources
      1m 58s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
CSS: Core Concepts
8h 49m Beginner Nov 22, 2011

Viewers: in countries Watching now:

In this hands-on course, James Williamson demonstrates the concepts that form the foundation of Cascading Style Sheets (CSS), including styling text, adding margins and padding, and controlling how images display. The course also explores the tools needed to work with CSS, the differences between embedded and external styles, how to use selectors to target elements, and what to do when styles conflict.

Topics include:
  • Exploring default styling
  • Writing a selector
  • Setting properties
  • Working with common units of measurement, including ems and pixels
  • Structuring HTML correctly
  • Understanding the cascade and inheritance
  • Setting a font family, font size, text color, and more
  • Understanding the box model
  • Styling container elements
  • Working with RGB vs. HSL values
  • Styling drop shadows
James Williamson

Letter and word spacing

To control the spacing between letters and words in CSS, we use the letter spacing and word spacing properties respectively. Now those of you familiar with print design will recognize letter spacing as tracking, which essentially means adding an equal amount of space between letter pairs. Now true kerning through CSS still eludes us at the moment, but as we'll discuss at the end of this lesson, it shouldn't be much longer until those capabilities are added as well. So for this example, we're going to be using spacing.htm which you can find in the 04_11 folder.

And just real briefly I'm going to look at structure of this to tell you a little bit about what we're going to be doing here. We've got a very simple structure to the page, but we have couple of headings that I want you to pay close attention to. We have one h2 with a class of letter, another h2 with a class of word, and we're going to use these to practice letter spacing and word spacing. We also have a class with render applied to it, h2 class of speed applied to it, and a paragraph with a class of render applied to it. And that's going to allow us take a little closer look at another property that's really not directly tied to word spacing or letter spacing, but it can help achieve optimal spacing in your text. Okay.

So let's jump in by taking a look at letter spacing. So we're going to target again this h2 right here with the class of letter applied to it. So I'm going to go up to where I'm supposed to add my styles. I'm going to type-in .letter and we're just going to go ahead and add letter-spacing. And we can use any value we want, we'll start off with something really kind of wacky, maybe 25 pixels, that's a lot. I'm going to go ahead and save that and I'm going to go ahead and preview that in a Browser. And you can see that has added a lot of letter spacing or a lot of tracking if you will to that particular heading.

Now I can come in and modify that a little bit. A lot of times in something like letter spacing, a little goes a long way. So I'm going to reduce that down to 5 pixels and save it and then test that again. And now you can see that as opposed to the other headlines, it's spaced out a little bit, looks nice, it might even be just a little bit too much tracking, but you can modify this anyway that you want. You can even use negative values, so I could come in here and say like -1, but I really wanted to tighten my letter spacing up. And you can see it really, really tightens those guys up.

And you can even go a little bit further with this to create kind of a special effect where the letters are running in together. And actually these days using CSS transitions, I could transition from that property and actually animate those letters coming out. So that's pretty cool. I'm going to take that back to a positive 5 pixel value and now let's go down to our next h2 which has a class of word applied to that and let's use that class selector word to practice using word spacing. So again, word-spacing, so very easy to remember those guys.

Here again, we'll just start off with something like 15 pixels maybe, we'll save that and test it and we can see that now word spacing again is getting this sort of extra spacing between the words. You can use pixels, you can use ems, you can use percentages, you can use whatever you'd like. So if I wanted to do 1em there, I could save that and it'll extend it just a little bit more. You can also use point ems, so if I said 0.2ems, for example, and save that, it's just going to increase the word spacing a little bit but not a lot. So those values are pretty cut and dried and pretty basic in terms of what you can do.

You can extend the spacing between the letters, you can extend the spacing between the words. But unlike true kerning, you're not to going to go in there and sort of manipulate letter pairs. Now there is a property that we have available to us right now that can help optimize the spacing between our letter pairs. And it's actually not even a CSS property. One of the properties in the SVG specification, and that would be the text rendering property, has been adopted by almost all the browsers as a way to control the rendering of the text within the Browser. Now SVG is a vector graphics specification, and this was really designed to control the rendering of vector text within the Browser space.

But that property has become so widespread you can pretty much use it anywhere. All right, so we're going to go ahead and practice with this property a little bit. I can see that I have an h2 with a class of render, I have an h2 with a class of speed, and I have a paragraph with a class of render. These two classes are going to basically deal with a couple of the values of this text render property. Let's write the selector for it and I'll show you want I mean. So I'm going to go up just below my last class selector which is word and the first thing I'm going to do to these heading 2s is I want to make them a little bit larger because the bigger the text is, the easier it is to see kind of what the Browser is doing here.

So I'm going to type-in h2.render, h2. speed, and then again, we're just going to make this text a little bit larger. So font-size 60 pixels. And then we're going to take the margins down to 0 so that they butt right up against each other, we can really compare them well. So if I save this and again preview this in the Browser, you can see, those two, now we can really sort of compare exactly what's going on with both of those headings. Okay. So on the next line below that I'm going to use the .render, so just any element with render applied to it.

And that is where I'm going to use this text rendering property. So if you look for it in CSS Specification, you won't find it. It's in the SVG Specification, so text-rendering. And there are several values that we can use for this. We can use keywords Auto, Optimize Speed, Optimize Legibility, or Geometric Precision. It's the Optimize Speed and Optimize Legibility that we're really concerned with. Optimize Speed basically says, okay, go ahead and render those characters with speed being foremost in your mind. So don't worry about the quality of the characters, don't worry about the spacing of them.

Just go ahead and get them rendered as quickly as you can. Optimize Legibility on the other hand tells the Browser or the user agent, hey, really take some time, take a look at this text, figure out what the optimize rendering for this is in terms of character spacing, in terms of the rendering of the characters themselves, take your time on it. So for render here, we're going to go ahead and optimizeLegibility, which is bad news for me because I'm terrible at this, but there is our text-rendering: optimizeLegibility. All right, now we're going to follow that with the class of speed and here we're going to change the text- rendering to optimizeSpeed; Once again, we're using CamelCase naming here where we have uppercase second word, lowercase first word.

I'm going to go ahead and save this, and then I want to preview this back in my Browser again. Now if you look at this and say, well, it doesn't really look like a lot has changed, James, you would be 100% correct. And that's because different browsers are implementing it slightly different ways. In Firefox, Optimize Legibility has pretty much become the default, especially for text, any text over 20 pixels. So this is one of those things that the Browser is just trying to do to help you out without requiring a lot of extra effort from you. Now other browsers like WebKit for example, they are still at the stage where you can turn it on manually, but it's not a default setting.

So if I go back into my code and preview this using say Chrome, which is a WebKit browser, here we can see there's a huge difference between it. You'll notice that for Optimize Legibility, take a look at the positioning of the T and the e next to each other. So those two letter pairs look a lot better than optimize for speed. So while this text might render a little quicker, this text is certainly rendering in a little bit higher quality. So it's one of those things that if you choose to turn it on for specific headlines where you think spacing really matters, it's going to you help in certain browsers, but in other browsers such as Firefox, it's sort of the default way of doing things.

Going back to the beginning of the lesson, word spacing and letter spacing, those two properties, they are not terribly exciting, but they do give you some capabilities that are very handy in specific situations. Remember, you can use negative values to tighten things up, positive values to sort of move things apart. Now I would caution you just as a designer against overusing them and be really careful about using large values for those properties, again a little goes a long way with those. Now if you want to learn more about some of the advanced typographic capabilities that are currently in development with CSS, I've given you a couple of links here on this page.

One is to the Text Level 3 specification which we've kind of already looked at. The other one is to the Fonts Level 3 specification. I'm going to open that up really quickly. And if you look in this specification, there's some really cool stuff in here that's currently under development. For example, these Font features properties, we have some Kerning, so font kerning is being developed, Ligatures, Numerical formatting, Alternates and swashes. So a lot of the stuff that we sort of take for granted in print design that we can do certainly with OpenType fonts, that's starting to come to the Web as well specifically with the adoption of Web fonts, which is bringing OpenType fonts to it.

So we're getting a lot of those capabilities added and as browsers begin to implement them, you're going to want to keep track of those so that you know when you can start taking advantage of those particular features. So overall, just make sure you keep track of what's going on so that you can use those properties when they become available in browsers, and for the time being, just remember you do have properties like letter spacing and word spacing that can extend your current typographic capabilities.

There are currently no FAQs about CSS: Core Concepts.

Share a link to this course
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.
Upgrade now

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.

Upgrade now

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


You have completed CSS: Core Concepts.

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

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?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

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:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can

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.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about 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

Sign up and receive emails about and our online training library:

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

submit Lightbox submit clicked