Click here to Skip to main content
15,881,882 members
Articles / Web Development / HTML
Tip/Trick

Create Stylish Search Button for Website

Rate me:
Please Sign up or sign in to vote.
4.80/5 (3 votes)
6 Jul 2013CPOL 61.7K   594   8   8
Stylish Search Button for Website

Hello Guys. I am again back with a trick How to Create a Stylish Search Button.

Let's Start

Step 1: Creating HTML Document

HTML
<form class="search" action="" method="get">
<input type="text" class="text" name="q" value="Search Here" 
onclick='value=""'/>
<input type="submit" type="submit" value="" class="submit" 
name="q"/>
</form>

We have just created a form having input box and submit button. 

Preview:

image1

Step 2: Creating Stylesheet/Style for HTML Document 

CSS
.search
{
background: url(5.png);
width:320px;
height:32px;
} 

Here we set the background-image of form, height and width(using class .search). 

Preview:

image2

CSS

CSS
.text
{
background:transparent;
width:290px;
height:32px;
border:0px;
outline:0px;
padding:10px;
font-size:15px;
border-radius:18px 0 0 20px;
-webkit-border-radius: 18px 0 0 20px;
-moz-border-radius: 18px 0 0 20px;
-o-border-radius: 18px 0 0 20px;
} 

 Now we set background of text box as transparent, set width and height of text box. Set Outline as 0 px so that no Outline is showed on clicking the text box.

We use border-radius to make round corners of text box.

Preview:

image3

In next step we do some work on button.  

CSS:

CSS
.submit
{
background:transparent;
border:0px;
height:23px;
cursor: pointer;
border-radius: 100%;
} 

 Here we set Background as transparent and Mouse icon as Pointer 

Preview:

 

That's All.
Hope you like it. Thank You .

Please View my Other Tips/Tricks:- 

Create Smart and Stylish Button 

Create Smart and Stylish Tooltip  

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
India India

Comments and Discussions

 
QuestionNice Pin
Member 1028596930-Dec-14 2:26
professionalMember 1028596930-Dec-14 2:26 
GeneralRe: Nice Pin
Anoop Kr Sharma30-Dec-14 4:08
professionalAnoop Kr Sharma30-Dec-14 4:08 
QuestionCSS3 Pin
NWPU_Tbeck12-Nov-13 15:15
NWPU_Tbeck12-Nov-13 15:15 
AnswerRe: CSS3 Pin
Anoop Kr Sharma12-Nov-13 16:19
professionalAnoop Kr Sharma12-Nov-13 16:19 
I have used some CSS3 property in this trick.for ex. border-radius property which I used here introduced in CSS3.

modified 24-Apr-14 10:10am.

GeneralMy vote of 5 Pin
Amir Mohammad Nasrollahi27-Jul-13 22:15
professionalAmir Mohammad Nasrollahi27-Jul-13 22:15 
GeneralRe: My vote of 5 Pin
Anoop Kr Sharma7-Aug-13 17:37
professionalAnoop Kr Sharma7-Aug-13 17:37 
GeneralMy vote of 4 Pin
hopeful4ever16-Jul-13 7:07
hopeful4ever16-Jul-13 7:07 
GeneralRe: My vote of 4 Pin
Anoop Kr Sharma16-Jul-13 7:57
professionalAnoop Kr Sharma16-Jul-13 7:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.