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

  • Home
  • SEARCH
  • 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 6178833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:31:58+00:00 2026-05-24T00:31:58+00:00

Task: Make text box 100% width but allow enough room for button. Problem: Button

  • 0

Task: Make text box 100% width but allow enough room for button.

Problem: Button appears on next line and text box exceeds width of its container.

<div class="field">
    <input type="text" name="my-field" />
    <input type="button" id="my-button" value="Add +" />
</div>

 .field {
     margin-right: -70px;
     width: 100%;
 }
 .field input[type=text] {
     display: block;
     float: left;
     margin-right: 70px;
 }
 .field input[type=button] {
     display: block;
     float: right;
 }

My primary layout uses the following trick to achieve flexible width with fixed sidebar, but for some reason this is not working on the above.

<div class="outer-wrap">
    <div class="content">
        ...
    </div>
    <div class="sidebar">
        ...
    </div>
 </div>

 .outer-wrap {
     margin-right: -300px;
     width: 100%;
 }
 .content {
     float: left;
     margin-right: 300px;
 }
 .sidebar {
     float: right;
 }

What mistake am I making here?

  • 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-24T00:31:59+00:00Added an answer on May 24, 2026 at 12:31 am

    You have to screw with the HTML a bit, but otherwise this works perfectly in IE7+ and all modern browsers.

    See: http://jsfiddle.net/thirtydot/25bZC/

    CSS:

    .field > span {
        display: block;
        overflow: hidden;
        padding-right: 10px
    }
    .field input[type=text] {
        width: 100%
    }
    .field input[type=button] {
        float: right
    }
    

    HTML:

    <div class="field">
        <input type="button" id="my-button" value="Add +" />
        <span><input type="text" name="my-field" /></span>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The task: Make the text content of the InlineUIContainer to be inline with the
my task is to make a program that can store arbitrary long text in
I'm looking for some way to make a relative text timestamp but using future
Simple task like make AJAX request , pass one parameter and return result, can
I have a task to make a survey to be displayed in SharePoint 2007
I want to make Task in Google Calendar using Google Calendar API : c#.
hey guys im working on a task to make my story's links like this
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript?
Task: I have a camera mounted on the end of our assembly line, which
I try to make a common solution for the following task: onclick event listener

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.