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 6788765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:31:26+00:00 2026-05-26T17:31:26+00:00

Is there an easy and elegant way to have an input remaining available space

  • 0

Is there an easy and elegant way to have an input remaining available space in a div with a button on the right without specifing any width on input neither button ?

<div>
    <input type="text"/>
    <button>button</button>
</div>

It seems easy but i can’t find a way to do it …

here the jsfiddle : http://jsfiddle.net/LLQQQ/

  • 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-05-26T17:31:27+00:00Added an answer on May 26, 2026 at 5:31 pm

    You can use display table / table-cell. This is not table-based layout, so people won’t flip their lid about it. You set div to display as table, and then use immediate descendants selector > * to make all immediate children to act as cells. Then you can specify widths on cells and they will do their best to take up full width. I had to wrap button in span because otherwise it would shrink.

    http://jsfiddle.net/LLQQQ/6/

    <div>
        <input type="text"/>
        <span><button>button</button></span>
    </div>
    
    div {
        border: 1px solid #000;
        display: table;
        width: 100%;
    }
    
    div > * { display: table-cell; }
    
    div > span { width: 1%;  }
    div > input { width: 100%; }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know if there is any easy/elegant way to determine the source
Is there any easy/general way to clean an XML based data source prior to
Is there an easy or at least elegant way to prevent duplicate entries in
Is there an easy and elegant way to convert an unsigned byte value to
Is there any more elegant way to do the following? Basically I need an
Is there any easy/short way to get the worksheet object of the new sheet
Is there an easy way to migrate a hosted LAMP site to Amazon Web
Is there an easy way how can I get in C char * from
Is there an easy way to iterate over an associative array of this structure
Is there an easy way in C# to create Ordinals for a number? For

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.