Here’s a quick way to style an input button
October 23, 2009 by Catalin Rosu – 12 comments
I assume there was at least one time when you wanted to add more appeal to a html input and at that moment you didn’t knew how.
We all know how boring looks an input when we use it without styling it and that’s why today I will show you the way to get rid of this old-style input.
For the beginning here is how a non-styled input looks like:
When styling and input button, we have two alternatives, to style it using only CSS with pout a background image, or using a custom background image.
1.USE ONLY CSS WITHOUT BACKGROUND IMAGE
First add a class or an id to your button. For this tutorial we will add an id because we do not intend to use this kind of button several times into a page:
Now let’s add some styles for the id:
border: 1px solid #777777;
font: bold 11px ‘Trebuchet MS’;
The final result looks like this:
Please note that border-radius actually is working only on Mozilla/Firefox, Google Chrome and Safari 3.
2.USE A CUSTOM BACKGROUND IMAGE
Start by creating a new .psd file with 78x28px size. From the left panel choose “Rounded Rectangle Tool” (ALT+U for Windows Users) and set a 4px radius.Fill it with #6e9e2d (green) color and apply some effects.
This is my result and also this is the Photoshop source file (please use it as you wish).
Download Photoshop FREE source file
Now, back to our code ….this image is 78x28px and we will use it as background image for our input.Here you have the new css code for it.
Note that this time you don’t need to use the value attribute anymore.
That’s it, i hope you’ll find it useful!