Join Justin Seeley for an in-depth discussion in this video Creating buttons, part of Illustrator for Web Design.
In this movie, I'll be exploring how to create buttons inside of Adobe Illustrator and also how to make them touch friendly. Towards the end of the movie, I'll also talk about how I comprised a large library of buttons which I can then reuse at any given time. So let's go to the File menu and let's choose new, and I'm just going to pick the Web preset, and I'll select something like 1024 x 768. It does not matter how big this is. I'll just hit ok. And so now what I'm going to do is I am going to create a series of buttons.
So I am going to do that by grabbing the Rectangle tool, and I'm just going to start clicking to create some buttons here. So the first one, we are going to make this is a fairly large buttons, so we are going to do 300 pixels. The width of buttons is totally up to you, but the height of buttons needs to stay within a specific range. Most of the time we are targeting desktop devices, but as we know, our content is not only being accessed by desktop machines anymore, so we have to make these buttons that we are creating touch friendly. In order to do that, we need to stay between a range of about 30 to 50 pixels, somewhere in there--some people say even 35 to 50 pixels.
So it just depends on your personal level of comfort and how big you really want the buttons to be. In this case, I am going to make the height of this button 40 pixels and once I do that, I'll hit OK, and so there is my graphic. And if I look at this 100% by going Command+1 or Ctrl+1 on my keyboard, you can actually see the physical size at which this button is going to be displayed. So I go ahead and turn off the stroke and let's change the color to something a little bit more fun, like green. And so there is my first button. That actually looks a little thin to me, so I might actually increase the height of this a little bit, and I can do that by just clicking and dragging down.
So maybe I make that 50 pixels. That's on the larger size of a touch-friendly graphic, but it does look a little bit better to me. I tend to gravitate more towards beefy end when it comes to creating buttons. Anything that's easier to click on is also going to be more likely to draw people's attention to it, so if this were a Buy Now button, I want that thing to be huge so people click on it. This is one way to create a button, just clicking and dragging out and drawing some mockup buttons. However if you are really going to get serious about these and you are going to be turning these over to a developer, you need to think in terms not only of just what the button looks like on the surface like this, but you also need to think in terms of states of the button, because when you go and interact with the button on the web, you are going to run into different states.
When you first look at a button you are looking at what's called the up state. This is the initial state that the button is showing you and that up state is very important because that's the main thing that draws people to click on that thing. You also need to worry about something called an over state. That's when someone hovers over this button. What is it going to look like? What is it going to do? Is it going to look pressed in? Is it going to extrude out? Is the text going to change, is the color going to change? Again, this is totally up to you, but that's another piece of the puzzle that you have to think about. You also need to think in terms of an active state.
If this was a piece of navigation, meaning I had several buttons going across the top, do we have an active state indicating that if I am sitting on this page, this particular menu item is highlighted telling me yes, you are here. Sort of like at the mall when you are walking past that big directory sign and there is a little sticker in the middle that says you are here, that's what that is for. The active state indicates where you are at any given time. Now the problem with these states is, when we talk about accessing these pieces of content from a device like an iPhone or an iPad or an Android tablet, we don't necessarily have the ability to hover with our finger, so the active state becomes also what's known as the click state or the down state so that when someone punches that button with their finger, they see some sort of interaction indicating that they have made contact with that button.
So you also need to think in terms of that as well. So when I am designing a button usually what I'll do is I'll come into Illustrator and I'll automatically set up three layers. So layer one becomes the up state, and I'll actually type that out, Up State, and I'll drag my Layers panel out so you can see it. So Up State. I'll create another new layer, and I'll call this Over State, and I'll create another new layer, and I'll all this Active State. You could also call this Down State if you wanted to. I'll move Up State to the top of the stacking order, Over right there, and Active towards the bottom.
That's usually the order they go in. And so once I have that done, I can then start to build out each one of these states. I usually lock the ones that I am not working on currently, so if I working on the Up State, I do that right there. And so for this particular button here I am going to make sure that it's aligned to the center of the document, just so I get it right in the center, and then I'll press Command+0 Ctrl+0 so I can see the whole thing. And so you have two different choices you can do here. You can actually create multiple states that lie on top of each other so it's easier for you to toggle visibility and show sort of the interactivity, or you can simply stack them on top of each other visually on the screen, so I like a button right underneath it, a button right underneath that, so you can see all of the states ones.
That's totally up to you as well. I tend to like the stacking on top of each other directly so that I can simulate the interactivity when I'm showing this to clients. So let me show exactly what I mean here. I am going to start with Up State. I'll make some changes to this, just so we can see it. And I'll select it and I'll go into the Appearance panel and I'll drag this out so you can see it, and I'll add another new fill to the top of it, and I'll change that fill to a gradient. And I'll go into the Gradient panel, and let's make that a radial gradient. Go into Transparency, change the transparency to Soft Light. And I'll also go up to the Effect menu > Stylize > Round Corners. Again I don't use the Rounded Rectangle tool in Illustrator.
It's just not flexible, so I use the Live Effect. Hit Preview to preview that. I can't really get a good preview because I'm zoomed out so far, but five pixels is usually okay. When I am doing rounded-rectangle buttons, I generally stay between a range of three to six pixels. Anything more than six generally tends to make it look more like a circle, and I just don't like to round it off that much. But you can do it any way you want. That's the beauty of web design; it's totally a personal choice. Hit okay, and once I do that, I'll click away from it so you can actually see what I've got.
The last step I might do is click on that and add a dark green stroke, just to give it a little bit of definition around the edges, and maybe increase the size to two or three points. And so there we go. I've got my button all ready to go and once I click away from it, you are going to notice that I don't see the round corners, and the reason for that is I accidentally applied the round corners to the fill. I was targeting the fill and not the overall shape. So what I'll do is select that and I'll move the rounded corners up in hierarchy like that, and once I do that, you'll see the rounded corners take effect all over.
So now I'll collapse that back up, and so there is my basic appearance for my Up State. I am going to select this now, copy it, and I am going to lock this layer and now I am going to unlock the Over State and select that layer and I'll do a Shift+Command+V on the keyboard to paste it in place. I am also going to temporarily hide the visibility for the Up State; that way I am only seeing the Over State right now. And so what I am going to do is make some changes to this, and I'll do that through the Appearance panel. So in the Appearance panel here I'll find that gradient fill and make sure I am targeting that by clicking on it.
I'll go to the Gradient panel, and I am simply going to reverse the colors. This is not obviously a great design choice, but it is just giving you an idea of what this is going to look like. And so once I do that, I've reversed those colors and I am also going to change the stroke. I am going to click on the stroke here and change the color something to a darker green. Click away from it. What happens if I turn back on the visibility for the Up State? There is the Up State.
So I can tell the client, this is what it look like when the button is first accessed in the web site. When you hover over the button, it will look like this. And then you could also do something like the active state where you change the appearance again. So you get the idea. I usually stack these up; that way I can show decent interactivity, simulate that for clients or developers, whoever I am handing this off to. But I always do these three layers when I am working with buttons because every button has this type of interactivity in it. I am going to reset my workspace. And let's talk about creating a button library, because inevitably you are going to be able to reuse a lot of buttons that you create inside of Illustrator.
So I am going to go and create a new document again, and I'm just going to create a series of buttons. And so I'll click here. Let's do 300 x 40. That's fine. And I am going to make sure there is no stroke and a black fill. I am going to line this up. Let's do another one. Let's do 250 x 40. There we go. Let's do 200 x 40. I usually go back in 50-pixel increments. There we go. I'll do 150 x 40, and then maybe one more: we'll do 100 x 40. Here we go.
So there is my buttons, just like that. It's a kind of scale of buttons that goes all the way down. And I also select all of them, and I apply the same effect to all of them as well. So if I wanted this to be a rounded rectangle set, I would go to Effect, and then I would go to Stylize and I would go Round Corners and I would then round the corner radius up to like 6, hit okay. There we go. They've all got rounded corners. So these are just basic buttons. I could use these in mockups or whatever I wanted, but I can also stylize them up if I needed to for full-on markup.
But I think that leaving them in a plain state like this lends them a little bit more to universal usability. I can use them in multiple projects and then I can just utilize the symbols that I create, modify the symbol after the fact, and change it to whatever I need it to be. So here are all my buttons. I am going to bring out my Symbols by going to Window > Symbols. And the first thing I do is I get rid of all these that in there right now because I don't really use any of these, so I'll just select them and hit trashcan to delete them. And then I am going to start dragging these over into the Symbol panel.
So I am just going to drag it over. I am going to call this 300px Btn 6pxl corner. I usually try to tell the width of the button and how round the corners are. The type does not necessarily matter unless you are taking this into Flash. This has no bearing on what this symbol is going to do inside of Illustrator, so unless you are going to be using this in Flash, I wouldn't worry about that. Same thing goes for 9-Slice Scaling. If you don't want to worry about that, you don't have to for now.
And so Align the Pixel Grid, absolutely. Hit Ok. There is that. When I hover over it, it tells me 300-pixel button for a 6-pixel corner. I'll do the same thing for the rest of these. I'll just drag them over, 250px Btn 6px corner. Hit okay. Drag it over. 200px Btn 6px corner. 150px Btn 6px corner. And the last one, 100px Btn 6px corner. Hit OK.
And so now I've created this button set which would be my 6-pixel corner set, and so I would go up here to the panel menu, I would choose save Symbol Library, and I would call this 6px_corner_btn for button. I would save it in my symbols. I could hit Save. And so now any time I need these in a mockup, I could just create a new document, hit OK. They are not going to be in my Symbols library by default, but if I go here, down to User Defined, I have 6px_corner_btn. I can load those up. And let's say that I needed a series of those 300-pixel buttons. I could just drag those out.
One, two, three, and I could close up the library. I'll reset my workspace here. And so I could line these things up, just like so, and I could use those for an ad mockup. That could be a web site navigation markup. Any number of things I could use these for, but it's just a great way to expedite the whole process, to save your buttons as a library which you can then reuse anytime you need. So hopefully by now you have a better understanding of how I create buttons here inside of Illustrator and the different processes and things you need to think about while you are creating buttons, and also how to take your buttons and create a library from them so that you can reuse them in any project that you might be working on.
- Customizing a web workspace
- Decoding the mysteries behind screen size and resolution
- Working with Pixel Preview and anti-aliasing
- Coloring web graphics
- Renaming and grouping layers
- Working with shapes and symbols
- Creating wireframes on a grid
- Styling text
- Creating image sprites
- Simulating web pages with artboards
- Optimizing and exporting your work