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

7873 views

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:

[code:html]

<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:

[code:html]

<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

Tags: ASP.NET, HTML

Jun 15 2009 2:57 PM

2 Comments

  • parth said

    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.

  • Samantha said

    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...

Add a Comment