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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:43:27+00:00 2026-06-16T05:43:27+00:00

I have this container div with two elements: <div id=container> <div id=right>Some, list, of,

  • 0

I have this container div with two elements:

<div id="container">
    <div id="right">Some, list, of, words, that, I, use</div>
    <div id="left">Person Name</div>
</div>​

And I want to make the #right div use up the space that is left by the #left div and hide the overflow.

Please also note that the #left div width is variable.

I came up with this css so far:

#container {
    width: 250px;
    border: 1px solid black;
    padding: 10px;
}

#left {
    white-space: nowrap;
    border: 1px dotted #ccc;
    display: inline;
}

#right {
    text-overflow: ellipsis;
    overflow: hidden;
    border: 1px dotted #ddd;
    white-space: nowrap;
    display: inline;
    float: right;
}

​
But the #right div still shows all text and end up on the following line, like displayed below:

Sample result

I played with making the #right div not float, adding width: 100% but nothing seems to work…

Does anyone know how I can make both be displayed on the same line, but making the #right div have its overflow hidden?

jsFiddle link: http://jsfiddle.net/y4xnx/13/

Edit: fixed my explanation of which divs should do what.

  • 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-16T05:43:28+00:00Added an answer on June 16, 2026 at 5:43 am

    It would help to put #left before #right:

    <div id="container">
        <div id="left">Person Name</div>
        <div id="right">Some, list, of, words, that, I, use</div>
    </div>​
    

    Then a few changes in the css should do what you’re wanting:

    #left {
        white-space: nowrap;
        border: 1px dotted #ccc;
        float: left;
        margin-right: 5px;
    }
    
    #right {
        text-overflow: ellipsis;
        overflow: hidden;
        border: 1px dotted #ddd;
        white-space: nowrap;
    }
    

    Example: http://jsfiddle.net/grc4/MvXuN/

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

Sidebar

Related Questions

I have this simple code to place two div #container elements side by side.
I have two different div elements on two different webpages that use two different
I have a div that contains two other divs,, like this: ---------------------------- | |
I have some images that are wrapped within containers like this: <div id=swatchcontainer> <div
I have an outer div element called container and two inner div elements called
I have this markup: <div id=container> <h1>Heading</h1> <p>Some text</p> <div class=foo>Some stuff</div> <div class=foo>Some
Here is my scenario. I have a container div that has (n) child elements
I have two <div> elements inside a container <div> and I need to align
I have two divs within a container. One floats left and one floats right.
I have this container div whose width I would like to set according to

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.