A Cool Bing-like Search Box (Button on the Inside)

by ashic 15. June 2009 18:57

In the recent “web 2.0” sites, we see cool search boxes, with the search button appearing “inside” the text box. How’d they do that? Microsoft’s bing search also has this feature. A snapshot of the bing search box looks like this:

search

It’s actually quite simple to do, with a bit of css. First, let’s look at the markup:


<div class='search-box'>
    <asp:TextBox runat="server" ID='txt1'></asp:TextBox>
    <asp:Button runat="server" ID='btn1' Text='Search' />
</div>
 

And let’s now see the associated css:


<style type="text/css">
    .search-box input
    {
        border:none;
    }
    .search-box
    {
        display:inline;
        border:1px solid #000000;
    }
</style>
 

And you can see the result:

my-search

Sure…it’s not exactly the same, but you can play around with it, change the css here and there, use an ImageButton or whatever to make it look exactly like you want. The idea is basically the same.

Hope that helps.

Shout it
Share or Bookmark this post…
  • DotNetKicks
  • LinkedIn
  • Technorati
  • msdn Social
  • del.icio.us
  • Digg
  • Reddit
  • StumbleUpon
  • Slashdot
  • Live
  • Google
  • Facebook
Categories: ASP.NET | HTML

Comments

6/3/2009 7:03:02 AM #

trackback

A Cool Bing-like Search Box (Button on the Inside)

Thank you for submitting this cool story - Trackback from DotNetShoutout

DotNetShoutout

6/3/2009 7:05:12 AM #

trackback

A Cool Bing-like Search Box (Button on the Inside)

You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetKicks.com

6/3/2009 7:30:15 AM #

trackback

A Cool Bing-like Search Box (Button on the Inside)

In this article, Ashic Mahtab shows how to create a cool bing search like search box using css. Note

Community Blogs

6/3/2009 9:36:07 AM #

trackback

A Cool Bing-like Search Box (Button on the Inside)

You are voted (great) - Trackback from WebDevVote.com

WebDevVote.com

6/15/2009 5:29:09 PM #

ds r4

I love using Bing for my searches nowadays..

ds r4 United States

6/28/2009 2:21:01 AM #

parth

Hi,
I want to put an image inside my ASP:TextBox

Not WaterMasrk or anything...Simple Image which always shows and stays even User Write something inside it.

PLease help me out with this.

parth India

7/1/2009 11:04:18 PM #

Ice Skating Game

Great blog Ashic!
Parth, i think you should put this inside your css.
background-image: url(http://www.domain.com/image.jpg);

Ice Skating Game United States

10/31/2009 6:47:57 AM #

Samantha

Yes I like the Bing Search box as well, But up to now I didn't cought the idea to use such a style on my site. Thanks for sharing the styles...

Samantha United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading




Powered by BlogEngine.NET 1.5.1.29
Theme by Ashic Mahtab

Stats