Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,971 courses, including more Web and personalized recommendations.Start Your Free Trial Now
- View Offline
Want to create your own icon fonts? Check out James' companion course, Creating Icon Fonts for the Web.
- 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
Skill Level Intermediate
One of the chief complaints that some designers, have about icon fonts is that unlike ping files and jif files and ASVG's and things like that icon fonts are typically just monochromatic. This is a specimen sheet that I've created, for the font that we've been using throughout the course called Chunky Mobile. This is an icon font I built specifically for this course. I'm going to be refining it shortly after that and then open sourcing it for the web. So, you guys are getting sort of an early version of it.
That you can take home with you, because it will be part of the exercise files. Part of the resource files at the end of the course. Alright. As I scroll down through here, though. You can see in this specimen, that all of these icons are a single color. In this case, black. But I certainly could have made them any color that I want. But if I scroll all the way down to the bottom, however. Aha! We have multi colored icons. So a lot of icon font sets out there will have multi colored icons, and that might prompt you to wonder, well wait a second. How does that work? How can you store multiple colors in, a single glyph file? Well the answer is, you can't.
If I go over to the font itself and I scroll down towards the bottom. You can kind of see what's going on here. We've got multiple glyph's, that when combined make a multi colored icon. So in the case of the map which is the one that we'll be doing in our uh,next couple of exercises, we have two versions of the map. We've got one monochromatic, version of it. And the answer's at the bottom. You can see we have one multicolored version of it, that is, made in much the same way that we used to make separations, when I was working in print design.
You have a single icon, for each color, and then we stack them one on top of each other and we can assign different colors. Is it a little bit of a heck? Yeah. It kind of is. But, since we are able to use the exact same type of structuring that we've been using up to this point it's still relatively semantic. Okay. So I have opened up the multi-color.htm file from the 04_05 folder. And in this exercise, what we are focussing on is the structuring of the HTML itself.
We'll style our multi-colored icon, in the following exercise. Alright so I'm going to scroll down, and since this is a specimen sheet it's got every single glif in the set. So we might have to scroll for quite some time. Here we are. Right al-, around line 115 to line 116 somewhere around in there, you're going to find an empty list item. Right here. And here's where we're going to put our map. Now I want to point out, using some of the existing code here kind of how this structure is working.
You're going to see that instead of using just one span tag, we're using two. Not only that but the span tags are nested one inside of the other. So if I have these guys selected you're going to see the outer span tag, has a data icon attribute. And the inner span tag has a data-icon attribute. Now in this case, this is the battery, and I want you to pay attention to which icon is being used where. So the outer icon is F102. The inner icon is F103. That's really important.
If we go out to our glyphs and we look at F102, that's the battery body. If we look at F103 That's the middle of it that's indicating the current charge. That means that the parent icon, in this case, f one of two is actually going to be underneath the nested icon. Now we could use CSS positioning to change that but if you change that it's sort of a logical structure. Okay, I'm going to go ahead and copy, the interior of the list item element just below our empty one and paste it in there then replace it with information specific to our maps.
The first thing I want to do is go find the DATA icons that I need for this. Now if I go back to my font file, I can see that I am using F One Zero Zero for the map body. And F101 for the pin, so we want the body to show up first then we want the pin. So I'm going to change this to F100, and change the interior one to F101. I'm going to go ahead and save that. The next thing I want to do is change the label.
And this really doesn't have anything to do, with the display of the icon. But since this is a specimen sheet, it makes sense to go ahead and have a label for this. And I'm just going to type in maps. And then I have to, I want to give the codes because, again, as a specimen sheet I want people to know what's mapped to what. All right. I'm going to go ahead and save that. And now currently, If I were to test the page as it is now If I scroll through it, the single color ones look pretty good, but the multi-color ones, not so good.
And that's mainly because the only styles we have right now controlling the styling of these icon fonts are the styles for just sort of the generic single icons. So what's happened is, these guys are stacking sort of in rows, so we need to change it so not only are they different colors but But they're also overlaying as well, and we'll do that in the next exercise.