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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:19:04+00:00 2026-06-15T22:19:04+00:00

I have a div containing divs with content. The outer div has a dynamic

  • 0

I have a div containing divs with content.
The outer div has a dynamic width (e.g. 80%).
The inner divs have a fixed width (e.g. 100px).

The problem is that i want to show only so much inner div’s so that no inner div “overflows” / “is cut” as in figure 1.

I also want to “distribute” the “free” space as margin between the inner divs equally distributed, as shown in figure 2.

I hope somebody understands my problem, and knows how to realize this with css and as less javascript as possible 🙂

Example Image

P.S.: If it is easy to do, would it be possible to have the first and the last div have a max. margin to the outer borders ?

  • 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-15T22:19:05+00:00Added an answer on June 15, 2026 at 10:19 pm

    Started this before you edited your question with more info, but I believe that the one missing piece you’re after is the text-align: justify in the ‘outer’.

    .outer{
        background: red;
        width: 80%;
        overflow: hidden;
        height: 48px;
        text-align: justify;
    }
    
    .inner{
        background: blue;
        width: 100px;
        height: 40px;
        margin: 4px;
        display: inline-block;
    }​
    

    Here’s a fiddle.

    Not entirely sure what you mean by max-margin, but it sounds like that could be achieved by giving the container a fixed padding on the left and right.

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

Sidebar

Related Questions

I have 2 divs, 70% and 30% widths, within a 100% width containing div.
i have a div containing multiple divs with absolute position, i want to handle
I have a div containing a number of inner divs with varying heights in
I have a div (id =container) that is containing other divs (many classes) I
I have a container div, containing 3 divs, a sidebar, a content and a
So I have 3 divs contained inside a containing div like such: <div id=contain>
I have a div containing a form. I use that div as a dialog
So I have a Div containing an iframe that I can Clone using JQuery.
I have an opaque div.opaque containing another div.inner. Since inner div is contained inside
I have a div, containing text and a few links. I want to trigger

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.