Skip to content Skip to sidebar Skip to footer

Input With Postfix Button In Top-Bar Using Zurb Foundation

I am trying to get a Text-Input with a Postfix Button in my Top-Bar using Zurb-Foundation as explained here: http://foundation.zurb.com/docs/navigation.php#btopCode However, using

Solution 1:

I had the same issue, if you take a look at the documentation, you'll see how to implement it properly.

It's at the bottom of the example snippet:

  <li class="has-form">
    <form>
      <div class="row collapse">
        <div class="small-8 columns">
          <input type="text">
        </div>
        <div class="small-4 columns">
          <a href="#" class="alert button">Search</a>
        </div>
      </div>
    </form>
  </li>
  <li class="divider show-for-small"></li>
  <li class="has-form">
    <a class="button" href="#">Button!</a>
  </li>
</ul>

Solution 2:

For Foundation 5, this is how I solved the problem:

nav.top-bar {
    $height: 1.8rem;
    $textFontSize: 0.8rem;

    .prefix, .postfix {
        /* So even though you can embed forms in the top nav, they get jankified.
           WOW.  This is kinda lame. */
        height: $height;
        line-height: $height;
        font-size: $textFontSize;

        i { 
            font-size: 0.8rem;
        }
    }

    .prefix {
        margin-top: 7px; 
    }

    .postfix {
        padding: 0;
    }

    input {
        font-size: $textFontSize;
        height: $height;
    }

Solution 3:

Try placing the form inside of a drop down. I don't think it will work directly on the nav bar it self. This is not documented well on the site and could use some improvement.

 <nav class="top-bar">
        <ul>
            <li class="name"><h1>Home</h1></li>
            <li class="toggle-topbar"><a href="#"></a></li>
        </ul>
        <section>

            <ul class="left">
               <li class="has-dropdown">
                   <a href="#">Search</a>
                       <ul class="dropdown">
                           <li class="search">
                                <form>
                                  <input type="search">
                                  <button type="submit" class="secondary radius button">Search</button>
                                </form>
                           </li>
                       </ul>
                </li>
                <li class="has-dropdown">
                    <a href="#">Item1</a>
                    <ul class="dropdown">
                        <li><a href="#">Sub1</a></li>
                        <li><a href="#">Sub2</a></li>
                        <li><a href="#">Sub3</a></li>
                    </ul>
                </li>
            </ul>
        </section>
    </nav>

Solution 4:

I had the same issue as you Search input in top-bar foundation cut off and managed to make it work after a while by float everything to the left and adding some !important and the inputs. What I found in foundation docs wasn't helpful but anyways, this did the trick:

.left .search .button { float:left; width:50px; margin-left:5px;}
.search input {width:200px;float:left;top:5px;}
.search form {float:left !important; width:450px !important;}

Post a Comment for "Input With Postfix Button In Top-Bar Using Zurb Foundation"