Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:26:57+00:00 2026-06-17T18:26:57+00:00

I am trying to create a menu where the text input field .search-form will

  • 0

I am trying to create a menu where the text input field .search-form will expand to take up the rest of the available horizontal space within .container. I also have a .cart, .logo, and .menu which has a width based on their content.

Currently, I am able to get everything to work, except that the .search-btn is on a different line then .search-form and I do not know how to fix this. It is important that .search-btn and .search-form are contained by the same div as I will create a drop-down that appears containing potential search results. This drop-down will have to be the same width of .search-btn and .search-form.

jsFiddle: http://jsfiddle.net/bnJPE/1/

html:

<div class="container">

    <a href="#" class="cart">
        <img src="http://www.placehold.it/27x27">
    </a>

    <a href="#" class="logo">
        <img src="http://www.placehold.it/100x27">
    </a>

    <ul class="menu">
        <li class="item"><a class="link" href="#">
            Item 01
        </a> </li>
        <li class="item"><a class="link" href="#">
            Item 02
        </a> </li>
        <li class="item"><a class="link" href="#">
            Item 03
        </a> </li>
        <li class="item"><a class="link" href="#">
            Item 04
        </a> </li>
    </ul>

    <div class="search">
        <input class="search-form" type="text" value="varying width">
        <a href="search-btn"><img class="search-icon" src="http://www.placehold.it/20x20"></a>
        <div class="suggestions">
            Potential Results Goes Here
        </div>
    </div>

</div>

css:

.container{
    width: 100%;
    float:left;
    height:30px;
    background: yellow;
    padding: 0;
    margin: 0;
}

.logo{
    float:left;
}

.search{
    overflow: hidden;
    background:aqua;
}

    .search > .search-form {
        width: 100%;
    }

    .search > .search-btn {
        width: 27px;        
    }

    .suggestions {
        background: #98faf9;
        height: 50px;
    }

.menu {
    float: left;
}

    .menu > .item {
        display: inline;
        list-style-type: none;
    }

.cart{
    float:right;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:26:58+00:00Added an answer on June 17, 2026 at 6:26 pm

    For the .search, remove overflow: hidden as it’s not needed, and use float: right. For the .search-form remove the width: 100%, because this prevents the button to move to the right, or set it to the initial of auto

    .search {
        background:aqua;
        float: right;
    }
    
    .search > .search-form {
    }
    

    Modified JSFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a css menu bar that has all grey text with
I'm trying to create a context menu which will be able to add extra
I'm trying to create a horizontal menu with a thick border bar that shows
I am trying to create a text based menu in Python. Here is the
I'm trying to create a sliding horizontal menu with different categories. I would like
I'm trying to create a TextView in the menu, the text is to be
I am trying to create a menu bar which will consist of a series
I'm trying to essentially create a drop down menu tied to a field that
I'm trying to create a context menu which will be able to add extra
I'm trying to create a menu that will stick at the bottom of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.