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…
  • Facebook
  • DotNetKicks
  • Digg
  • LinkedIn
  • Technorati
  • del.icio.us
  • Google
  • Live
  • Tumblr
  • msdn Social
  • Ping.fm
  • Reddit
  • Slashdot
  • StumbleUpon
  • TwitThis
Categories: ASP.NET | HTML

Comments

5/3/2009 6: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

5/3/2009 6: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

5/3/2009 6: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

5/3/2009 8:36:07 AM #

trackback

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

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

WebDevVote.com

5/28/2009 1: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

9/30/2009 5: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.6.1.0
Theme by Ashic Mahtab

Need an expert?

Ashic Mahtab
ashic@live.com
(+44) 07879927393

Stats

Featured Ads

 

Donations

I maintain this site and create all content entirely in my own time just to help you guys out. If you find the stuff helpful, or cool or just like what you see, I'd appreciate you chipping in to help out with the hosting costs. It's easy to do so - just click the button below - no amount is too low :)