It can be challenging to achieve good design aspects for the form controls like select drop down, input box, submit buttons, etc
But with the help of Cascading Style Sheet (CSS), it has become very easy to assign different look and feel to the form controls which comes by default in a plain look and feel.
In this article we will talk about two different styling effects
1) Giving background image to the input box to give completely different feel and make it consistent with the website design
2) Giving background repeating background image to the submit buttons to give consistent feel with the web design
Background image to the input box
To achieve the following effect
You first need to create the background image and save it with the “search_bg.jpg” filename or any other filename and then use the below code into your CSS file to assign the background image to the relevant input box to make look like your website design.
background:url(../images/search_bg.jpg) 0% 20% no-repeat ;
padding:3px 5px 5px 25px;
Repeating background image to the submit box
To achieve the following web design effect
You first need to create a background image cut of 1px width and full height of the button graphic and then use the below code into your CSS file to assign the repeating background to all the buttons on the website to make it compatible to the design what the web designer has created.
font: bold 13px Arial, Sans-serif;
padding: 2px 5px 2px 5px;
background:#a45b06 url(../images/button_bg.gif) repeat-x top left;
Finally you use the following code into the relevant HTML page
<input type=”submit” value=”Search”>
You can assign the class button to all the buttons of the website (no matter what is the width of the button) and it will work.
The final result will look like below once you complete the process. This will meet the expectations of the web designers.