Styling the default wordpress search box

I can’t figure out what’s causing the blank space between the submit button and the input area of the searchbox.
http://i.imgur.com/q4Dqz.png

html:

Read More
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>">
<p><input type="text" class="field" name="s" id="s"  placeholder="Search" />
<input type="submit" class="submit" name="submit" value="Traži" /></p>

css:

#searchform {
    float: right;
    padding-top: 10px;
    position: relative;
}

header input#s {
    margin: 0;
    border: none;
    height: 29px;
    width: 250px;
}

header input:active  {
    border: none;
}

header input.submit {
    border: none;
    height: 30px;
    width: 30px;
    margin: 0;
    text-indent: -99999px; 
    background: white url(images/search.png) 0 0 no-repeat;
    padding-right:20px;
}

Related posts

Leave a Reply

3 comments

  1. This is one from the most frequently questions, it’s very important to have a nice search bar with a good look,
    you did a nice work ,but the best way to create a better search bar is like that, follow me step by step it will helps you a lot, the look you want in a short time :

    1. you create the form tag and inside you create a div with class expl : searchBarContainer

    2. inside your div you create an input:text and button don’t use input:btn
      // now you have a form / div / input text and button

      <form  method="get" action="">
      <div class="searchBarContainer">
          <input type="text" class="searchBox" name="s" id="s"  placeholder="Search" />
          <button class="btn-search">
             <img src="search-icn.png" >
          </button>
      </div>
      

    enter image description here

    1. now we have the structure and we need just a style for our form it looks ugly right ? of course it is, so :

      .searchBarContainer {
      border: none;
      height: 2.5rem;
      background-color: #fff;
      border-radius: 2px;
      box-shadow: 0 2px 2px 0 rgba(0,0,0,0.16),0 0 0 1px rgba(0,0,0,0.08);
      box-sizing: border-box;
      width: 20%;
      max-width: 60%;
      display: flex; /* <===== the most iportant line in this code */
      

      }

    enter image description here

    in this code dyplay flex all that you need to focus on :
    display : flex;
    felx : 1;

    .searchBarContainer .searchBox {
        flex : 1; /*  <===== the most iportant line in this code */
        font-size: 14px;
        color: #000;
        border: none;
    
    }
    

    enter image description here

    1. And last for the button style :

      .btn-search {
      border: none;
      background-color: #fff;}
      

    Final Result

    enter image description here

  2. .sidebar.widget-area .widget.widget_search .search-form .search-submit {
        position: absolute;
        padding: 0 19px;
        background-image: url(assets/images/search.png);
        border: 0;
        background-color: transparent;
        right: 0px;
        top: 29px;
        color: #7a7a7a;
        cursor: pointer;
        font-size: 0px;
        height: 17px;
        width: 10px;
        background-repeat: no-repeat;
    }