Deploying Icon Fonts for the Web
Illustration by John Hersey

Normalizing icon fonts


Deploying Icon Fonts for the Web

with James Williamson

Video: Normalizing icon fonts

You never really know where you're going to need to use an icon font. I'm going to set the letter spacing to normal.

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
please wait ...
Watch the Online Video Course Deploying Icon Fonts for the Web
2h 4m Intermediate Apr 29, 2014

Viewers: in countries Watching now:

Icon fonts are a fast, effective way to feature scalable vector artwork on websites. James Williamson shows you how to properly deploy icon fonts on your own site in this short course. Learn how to find an icon font that's right for you and style it so it appears exactly the way you want. Then learn about deployment options that will make your icons accessible and display consistently across multiple browsers and devices. James also introduces advanced styling options such as animated and multicolored glyphs.

Want to create your own icon fonts? Check out James' companion course, Creating Icon Fonts for the Web.

Topics include:
  • Finding icon fonts
  • Ensuring consistent styling
  • Exploring class-based solutions for deployment
  • Deploying with the data-icon attribute
  • Aligning icons
  • Animating icons
  • Styling multicolored glyphs
James Williamson

Normalizing icon fonts

You never really know where you're going to need to use an icon font. Some icons might appear inside of a paragraph, others might appear inside of something like a heading or a list, and you might use it in a stand alone element like a div or some type of other black level element. Well that type of flexibility is really one of the strengths of icon fonts. But it also means that you have to be aware of the apparent element that it's inside of. You have to be aware of that apparent elements styling that could cause your icons to display incorrectly.

That's why it's a really good idea to do what we call normalizing our icon styling by going ahead and setting explicit values for things like font weight and font style. And so, to demonstrate that, I'm going to use the normalize HTM file, found in the 02_03 directory. I'm just going to scroll down, I'm previewing it in the browser right now. And I've got this particular icon used in three different places. One is inside of a heading, another is inside of a italicized paragraph, and another one is just sort of standing off all by itself inside of a div tag.

And as you can see, it's actually affecting it slightly differently in each instance. It's italicized over in the paragraph, it's a little bolder that the actual icon inside the heading because the heading is bold as well, and there's a weird spacing issue going on inside the div tag down there, that isn't really being controlled through margins. So there is a lot of styling going on to our icons that aren't driven by the icons, themselves, but rather the parent elements. So if I go back into my code editor, I've got the normalize file here open. And you can see kind of how this is constructed.

So we're assigning the icon through the use of the data icon attribute. We'll talk about how to do this a little bit later on, but I just wanted to point out the fact that this particular version of icon font that we're using, Chunky Mobile, is actually encoded to the private use area, so that's what you're seeing there. Here, we have it inside of the heading. Here, we have it inside of the heading, here we have it inside paragraph, and the, here we have it all by its little lonesome. So, three separate places. I'm going to switch over to the CSS file for normalize.htm and that would be base.css. You can find this in the _css directory in the same folder.

And I'm going to scroll all the way down towards the bottom, just saving myself a little bit of time by just shooting right down there. Okay. So I have a little area in here called icon font styles. And these are the only things that I really need to do right here to get my font to display. But I'm going to create some blank lines up here so that I can control the styling. Now there are a lot of different ways to normalize them, and a lot of how you write the selector that's going to do the normalization is based on how you're deploying it. For this example, I'm going to write a global selectory using the universal selector.

That's going to target anything that might have that data icon attribute. That's kind of a really big, broad selector, and it's not something that I might use every single time I depoy icon font, so I don't want you to watch this exercise and think oh, this is the way that I should do this from now on. It's about memorizing the properties that I want you to sort of take with you, not the selector that I'm writing here. So I'm going to do a star, and then I'm going to do attribute-selector, where I'm targeting any element that has the attribute of data-icon. Because that is, in this instance, how we're assigning the icon font.

Open up more curly braces, and then inside that now I'm going to go in and start normalizing it. So these are the properties that I want you to be aware of. So the first thing i'm going to do is font weight. And I'm going to assign this a font weight of 400 I could have said normal, but I really like being explicit with that value 400, because that is what my font was mapped to, in terms of being a regular font. So that's very explicitly saying that you want the default weight for that. Alright, so a font-weight of 400. I'm going to do a font-style of normal. I'm going to do text-transform of none.

I'm going to do font-variant of normal. I'm going to set the letter spacing to normal. And I'm going to set line height to one. Now let's talk about these individually. Okay, so, font weight and font style, those are kind of obvious. I want them to not appear bold. I don't want it to italicize my icons, so both of those things are going to override any parent styles that might be affecting it. Now, text transform and font variant, it's probably really doubtful that I'm going to have too many icons in parents that have small caps applied to it.

But I'm sort of covering my bases here. As far as text transform goes, capitalize or upper-case probably won't affect an icon font. But I don't want to take the chance. So, for different various browsers and devices out there, I'm just going to go ahead and say don't do it at all. Letter spacing, this could really affect my icons if I am trying to control the positioning beside other pieces of text. So I'm going to go ahead and set that to normal. And for my line height, a lot of times you can use line height to control the vertical alignment or vertical placement of an icon within a parent. So I'm just going to go ahead and set that to one as the default, and then I would override that anywhere that I would need to.

What I'm going to do is save this, then go back out to my browser. Okay, so here I am in the browser, and this is the original one. So you can see everything's still italicized. We've got the standalone one that's awkwardly positioned down there. And then we have to bold one here. And if I click over to our normalized version of this, you can see a couple of changes occur right away. Obviously, this icon is not italicized anymore, this one has moved up because of the line height isn't tied to whatever it was inside of before. And, although this is a little bit more subtle, if I toggle back and forth, you can see that the bold versus normal is actually causing that to display maybe a little but crisper, maybe not as fat in certain areas.

It's a really subtle difference but there's a definite difference there in image quality. So keep in mind that even though we used that sort of global selector, that you can normalize your icon fonts either that way through the use of a global selector or you can do like individual selectors as you assign the icon font elements. It's really up to you. You're just going to want to use the most efficient styling possible, but in large part how you normalize your icon fonts is going to be driven by how you choose to deploy them.

There are currently no FAQs about Deploying Icon Fonts for the Web.

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


You have completed Deploying Icon Fonts for the Web.

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 ?

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 preferences from the dropdown menu.

Continue to classic layout Stay on new layout
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 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.

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
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.