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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:48:03+00:00 2026-05-23T22:48:03+00:00

The challenge is to come up with this: +————————————–++—————-+ | This is a header

  • 0

The challenge is to come up with this:

+--------------------------------------++----------------+
| This is a header with potentially    || button div     |
|                                      ||                |
| long text that will wrap most likely |+----------------+
|                                      |
| but can't go under the button to the |
|                                      |
| right                                |
+--------------------------------------+

Not a big deal with a typical 2 column layout where you set the left column’s margin to equal that of the div on the right. The variable in this particular example, however, is that I won’t know how wide the div on the right will be at any given time (it’s based on a line of text that will vary.

In summary, I need:

  • a 2 column layout
  • both columns take up the full width
  • column on right is as wide as the text it contains
  • column on left is as wide as the leftover space

It seems like I would have had to have built this before but I’m stumped.

I’m open to CSS, JS or jQuery solutions.

Actually, I can already see a fairly easy jQuery solution. I can grab the rendered width of the div on the right, then do some math subtracting that width from the width of the parent container and then setting the width of the left column the same. That’ll be my fallback plan if there’s not a clean CSS option.

  • 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-23T22:48:03+00:00Added an answer on May 23, 2026 at 10:48 pm

    See: http://jsfiddle.net/vpADP/

    It will work in IE7+ and all modern browsers.

    HTML:

    <div id="buttonDiv">button div as wide as text</div>
    <div id="leftDiv">
        left div
    </div>
    

    CSS:

    #leftDiv {
        overflow: hidden
    }
    #buttonDiv {
        float: right
    }
    

    That’s not the typical use of overflow: hidden, read this for details.

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

Sidebar

Related Questions

Challenge: I have this code that fails to compile. Can you figure out what's
I challenge you :) I have a process that someone already implemented. I will
The challenge The shortest code by character count, that will output musical notation based
The challenge The shortest code by character count that will generate a beehive from
The challenge The shortest code by character count that will output the numeric equivalent
I come up against this challenge frequently -- and when trying to solve I
I'm working on an Android application that will come with lots of data. I'd
I have a SQL challenge that is wracking my brain. I am trying to
I have come across this excellent blog explaining how to provide access to private
I never seen this but I wondering if somebody has come across. Having a

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.