Make your search bar pretty

06 27, 2012

I’ve stumbled upon an article by Natalie Jost on how to make your search bar look pretty. I forgot the exact title of the post. This was almost a year two years ago, I think. Now, I have a hard time searching the original post since she moved to Tumblr. ;( Anyway, do you want your search bar to look like mine? ;)

Or do you want it in a different color? Pastel pink perhaps?

Open your searchform.php file. Replace all the code there with this one.

<div class="searchtitle">
   <div class="scatter_box_fixed-background">
    <div class="scatter_box_fixed-border1">
        <div class="scatter_box_fixed-border2">
            <div class="scatter_box_fixed-content">

<form id="searchform" method="get" action="<?php bloginfo('home'); ?>/"> 
<input type="text" value="enter keywords here" onfocus="if (this.value == 'enter keywords here') {this.value = '';}" onblur="if (this.value == '') {this.value = 'enter keywords here';}" size="20" maxlength="100" name="s" id="s" /> </form>
	        </div>
            </div>
      </div>
   </div>
</div>

Then place this in your css file. ♥ It’s that easy.

.searchtitle{
margin-left:7px;
margin-bottom:20px;
}

.scatter_box_fixed-background {
background:#C6E5D9;
height:35px;
width:160px;
text-align:center;
}

.scatter_box_fixed-border1 {
border-left:1px dashed #434034;
border-top:1px dashed #434034;
height:35px;
left:1px;
position:relative;
top:-3px;
width:158px;
}

.scatter_box_fixed-border2 {
border-bottom:1px dashed #434034;
border-right:1px dashed #434034;
height:35px;
left:3px;
position:relative;
top:-1px;
width:158px;
}

.scatter_box_fixed-content {
display:block;
left:0;
line-height:1.4;
padding:2px 0 0 10px;
position:relative;
text-align:left;
top:5px;
}

UPDATED: 11/27/11 I found a way on how this can be used on Blogger. :)

Go to Page Elements >> Add a Gadget >> HTML/ Javascript. Done? Copy paste this code and then save. Recheck this code if it’s complete because Blogger has the annoying habit of deleting codes on HTML/Javascript boxes.

<div class="searchtitle">
   <div class="scatter_box_fixed-background">
    <div class="scatter_box_fixed-border1">
        <div class="scatter_box_fixed-border2">
            <div class="scatter_box_fixed-content">

<form id="searchform" method="get" action="/search">
<input type="text" class="searchinput" value="enter keywords here" onfocus="if (this.value == 'enter keywords here') {this.value = '';}" onblur="if (this.value == '') {this.value = 'enter keywords here';}" size="20" maxlength="100" name="q" id="s" /> </form>
	        </div>
            </div>
      </div>
   </div>
</div>

For the CSS, go to EDIT HTML and paste this code just before the closing head.

.searchtitle{
margin-left:7px;
margin-bottom:20px;
}

.scatter_box_fixed-background {
background:#FDF2F0;
height:35px;
width:160px;
text-align:center;
}

.scatter_box_fixed-border1 {
border-left:1px dashed #434034;
border-top:1px dashed #434034;
height:35px;
left:1px;
position:relative;
top:-3px;
width:158px;
}

.scatter_box_fixed-border2 {
border-bottom:1px dashed #434034;
border-right:1px dashed #434034;
height:35px;
left:3px;
position:relative;
top:-1px;
width:158px;
}

.scatter_box_fixed-content {
display:block;
left:0;
line-height:1.4;
padding:2px 0 0 5px;
position:relative;
text-align:left;
top:5px;
}

.searchinput {
background-color: transparent;
border:none;
padding: 0;
margin:0;
outline: none;
}

Just let me know if you have any problems with it. ;)

**This post was originally published on this blog last Nov. 24, 2011.

5 Responses | Click to add your comment

  1. Kira says:

    Arvee, this is so pretty, thanks for the tip! I’m going to add it to my blog. Do you know if I can also change my email subscription box to look similar? I use the Jetpack email widget. I really appreciate your tutorial and help, I’m a pretty experienced blogger but my CSS knowledge is pretty much zero. Learning is on my to-do list!

    • arveerella says:

      Hello Kira! ;) Glad you liked the pretty search bar to place it in your blog. About the Jetpack email widget, I tried editing it, but couldn’t find the exact php file to work on it. ;( But I guess if you’re using the feedburner email for subscriptions, you can make it look similar to your pretty search bar. ;)

  2. Pratya says:

    Thank you so much for the tips, Arvee!
    I’ve placed it on my blog with a little adjustment on color and size :)

  3. Alyssa says:

    Hello! I was trying to do this but when I pasted the html into a widget it just came up as a search box. What am I doing wrong? It’s not colored or has a dashed border;\
    Thanks!

    • arvee marie says:

      Hello Alyssa! You got a very colorful blog! I like it! ;) You still have to copy the css code to style the search box but I think you’ve already figured it out. ;) Looks great!

Leave a Reply