Tutorial: How to create a pixel perfect button in Adobe Photoshop
You can create a button in Adobe Photoshop as follows:
- Create a new document in Photoshop. Match the properties with the screen grab and set up a grid in line with the designated specifications.
- Choose a foreground colour, select the rounded rectangle tool and draw out your shape. The grid lines should match up to the button shape. The grid can now be turned off.
- The pixel perfect button can now be styled using style layers. Three layers need to be added -gradient overlay, inner shadow and inner glow.
- Text now needs to be added to the button using the horizontal type tool. The button shape and button text should be aligned centrally.
- You can quickly edit the button using layer style effects, the vector mask and the direct selection tool.
Welcome to my first Think Tank tutorial. Here you will learn how to create a simple pixel perfect button in Photoshop. Below you can see the difference between a pixel perfect button and one that isn't pixel perfect.
First open up Photoshop and create a new document (File > New). Then make the properties match those shown in my screen grab.
Next we will enable and set up a grid. Personally, I only really use grids when I want to quickly draw out shapes, at precise sizes, so I regularly turn them on/off as and when I need them. First enable the grid from the top menu (View > Show > Grid), then enable snap to grid (View > Snap To > Grid), this will help restrict your shape to precise pixel sizes when you draw out your button.
You can see my grid preferences below, I usually like to have a grid line every 10 pixels. Make sure that your grid line is set up to pixels, rather than cm or mm etc. Don't worry about the grid obscuring your view, once the shape is drawn we can turn it off.
Now we have our document and grid set up, we can draw our button shape. First choose a foreground colour (I'm using #00ABED).
Then select the rounded rectangle tool (with a corner radius of 3px selected from the menu at the top) and draw out your shape in the middle of the document. I have drawn mine to be 180 pixels by 40 pixels.
If you zoom in to take a closer look (I've zoomed into 1200%), you will see that the button shape matches right up to the grid lines and is pixel perfect. We can now turn off the grid view (View > Show > Grid).
Now that we have our pixel perfect button shape, we can style it. If you haven't used layer styles before, you can find them at the bottom of the layers panel.
We will be adding 3 layer styles: Gradient overlay, inner shadow and inner glow. We won't be adding any colour to these styles which will allow the button colour to be changed very quickly in the future, but more on that later. First off, lets add a gradient overlay. Select 'Gradient overlay' from the layer styles panel. Once this is open click on the gradient box to open up the gradient editor. Make sure that both ends of the gradient are white in colour, then bring the opacity of the left hand side down to '0' and click 'OK' to close the gradient editor. Now on the Gradient Overlay section of the layer style panel, bring the opacity down to 40%. Your button should now have a subtle light gradient effect over its blue colour.
Now we can add the Inner shadow & inner glow layer styles. See screen grabs below for the settings I have used.
Now your button should look something like this.
The next step is to add text. Select the horizontal type tool from the left hand Tool menu. Change your foreground colour to white and click into the document and type out your button text. In this instance I have chosen to centre my text. Once you have your button text you can change the font and font size, you can even add a drop shadow with layer styles if you wish.
Now we want to have the button shape & button text aligned centrally. To do this select the move tool in the tool panel, then select both layers in the layer panel (You can select multiple layers by holding control whilst clicking or if you are a Mac user like me it's cmd + click). Once both layers are selected an align panel will appear in the top menu, you can then align the vertical and horizontal centres.
Now we have a finished pixel perfect button. The only thing left to do is put both layers into a layer group to keep your psd file tidy.
Now we have a finished button, you need to know how to quickly edit it. The beauty of creating layer style effects that don't have specific colours (only white & black have been used in the layer styles) is that you can quickly change the button colour, simply by changing the shape colour. You can do this by clicking on the layer thumbnail in the layers panel, then simply select a new colour.
To edit the size I would always recommend editing the vector mask, as opposed to using the free transform tool. This will help keep your corner radius at the size and proportions you intended. To do this first select the vector mask thumbnail in the layers panel. Then you will need the Direct selection tool from the tool panel, this allows you to select the shape points you wish to move. Once you have these selected, you can make the button wider or more narrow. I personally prefer to do this using the arrow keys. However, when you do this it is very important to work at 100% zoom view, other wise you can potentially lose that pixel perfect edge.
So, that's the end of this basic tutorial. I hope you have found it useful. If you would simply like to take a look at this button in detail, you can also download the source psd file here.