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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:18:29+00:00 2026-05-22T23:18:29+00:00

I have two divs floated left so that they appear next to each other.

  • 0

I have two divs floated left so that they appear next to each other. They are both populated with dynamic content so that for some users the left div may have more items and height and for others the right div might be longer.

I want to put a border in between the two divs so that it is border-right on the left div if the left div is longer or border-left if the right div is longer.

My thought is to do this at run time so that the php code checks the # of items in each div first and then proceeds to add the appropriate in line style tags to the appropriate divs. It will probably work but I’m wondering if there’s an easier way to do this through css?

  • 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-22T23:18:30+00:00Added an answer on May 22, 2026 at 11:18 pm

    What you can do is set the two divs to overlap by their border width, and set a border-right on the leftmost float, and a border-left and position: relative on the rightmost float. Then the line will appear to grow with the longest one, but in actuality it is 2 overlapping borders.

    I set up two examples on jsfiddle so you can see them. But I am attaching the CSS here. I used horribly obvious colors just to make it clear what I am showing.

    Links to JSfiddle complete code:

    http://jsfiddle.net/8nU6K/1/

    http://jsfiddle.net/8nU6K/2/

    .container{
        overflow:hidden; 
        background-color:red; 
        width:350px;
    }
    
    .left, .right{
        padding: 3px;
        float: left;
        margin: 0;
        background-color:white;
        width: 150px;
    }
    .left{
        border-right:10px solid green;
    }
    
    .right {
        position:relative; 
        left:-10px; 
        border-left:10px solid blue;  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two divs one floated to the left and the other to the
I have two divs that are not nested, one below the other. They are
I have two divs floated next to one another: <div id=parent> <div id=child_1 style=float:left>
I have two HTML tables in div s floated next to each other. The
I have two divs sr-left-checks and sr-right-checks. they both contain unordered lists. The left
I have two divs floating next to each other, with class name div1 and
I have two divs that are sliding from right to left. I am having
I have two Divs that are floated right, but I would like one to
I have floated two divs left but the div on the right has a
I am trying to place two divs next to each-other on the same line,

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.