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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:07:53+00:00 2026-06-17T16:07:53+00:00

I have a varying number of <div> s inside a container <div> , that

  • 0

I have a varying number of <div>s inside a container <div>, that are each set to display:inline-block, have a -webkit-border-radius and some padding. I would like to position each of the <div>s in a way that the one to the right overlaps the one to the left enough, so that there is no break in the border on top and bottom. Also, Ideally the container <div> would only have a width that is exactly the size of the styled divs inside (hight of LAST_DIV and width equal to the distance from the leftmost to the rightmost div).

                         ----------------
   --------------------/                  \
 /          /         |                    |
|    DIV_1 |    DIV_2 |    LAST_DIV        |
 \          \         |                    |
   ------------------- \                  /
                         ----------------

Since the number of <div>s that will display varies, I ruled out absolute positioning. I would like to refrain from javascript or adding additional elements to the html document, since I am creating multiple styles for the same website element, and some of those styles might not have rounded <div>s that have to overlap.

Edit:

I have tried setting only a border radius to the left edge of the inner divs and giving the container div a border on top and bottom and setting a negative value for left until the overlapping border of the container div disappears. When all divs are the same hight, this gave me issues at the right end, since the container div now extended over the right end. This also gave me issues when the individual divs had different colors.

  • 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-17T16:07:53+00:00Added an answer on June 17, 2026 at 4:07 pm

    You could try it something like this:

    demo

    HTML:

    <div class='container'>
        <div>DIV_1</div><!--
        --><div>DIV_2</div><!--
        --><div>LAST_DIV</div>
    </div>
    

    Relevant CSS:

    .container, .container div { display: inline-block; }
    .container div {
        padding: .25em 1.25em;
        border-radius: .65em 0 0 .65em;
    }
    .container div:not(:first-child) {
        margin: 0 0 0 -.65em; /* negative left margin, same value as border-radius */
    }
    .container div:last-child {
        padding: 1.25em;
        border-radius: .65em;
    }
    

    Note

    Any kind of whitespace (space, tab, newline) between elements that have display: inline-block; set on them matters. This mean that a newline in the HTML between the divs in the container will introduce a space between them. There are a few fixes for this. The one I’ve chosen involves adding a comment between </div> (closing tag of a child div) and <div> (opening tag of the following div).

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

Sidebar

Related Questions

I have a varying number of inline-block divs that I want to collectively take
I have a dynamically generated page with varying number of items (div.item). Each item
I have a virtual datagridview that I want to set varying row heights for.
Ok so I have this macro that is supposed to take a varying number
If you have two TextViews side by side each with a varying number of
I have a varying number of links that I need to add to a
Essentially I have a single view that accepts different operations and a varying number
I have a text file containing ~300k rows. Each row has a varying number
I have a <div> in my page which contains a <table> of varying number
I have a div containing a number of inner divs with varying heights in

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.