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

  • Home
  • SEARCH
  • 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 4063188
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:41:38+00:00 2026-05-20T15:41:38+00:00

I have a parent div with a variable number of equally sized child divs

  • 0

I have a parent div with a variable number of equally sized child divs floated left. I want the parent div to expand to the width of the children no matter what, even if it means overflowing its own container.

Is there a way to do this naturally with HTML/CSS?

Example (The stretchable div would wind up being 180px wide):

HTML:

<div id="stretchable-div">
    <div class="child"></div>
    <div class="child"></div>
    <div class="child"></div>
    ...
</div

CSS:

.child {
   width: 60px;
   height: 60px;
   float:left;
}
  • 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-20T15:41:38+00:00Added an answer on May 20, 2026 at 3:41 pm

    In this example the stretchable-div element will bust out of its parent, and stretch to its children.

    Live Demo

    css

    #parent{
        width:200px;
        height:180px; 
        background:red;
    }
    
    #stretchable-div{
        background:blue;
        position: absolute;
    }
    
    .child {
       width: 60px;
       height: 60px;
       float:left;
    }
    

    Markup

    <div id="parent">Im a parent
        <div id="stretchable-div">
            <div class="child">a</div>
            <div class="child">b</div>
            <div class="child">c</div>
            <div class="child">c</div>
            <div class="child">c</div>
            <div class="child">c</div>
            <div class="child">c</div>
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery 1.6.2 I have a variable number of floated divs inside a parent.
I have a main parent div that is .resizable(). One of it's child divs,
The number of divs is variable, but they all share a parent container: <div>
I have several divs that I want to work with dynamically. <div class=parent-19 id=123>
I have a parent div that is filled with multiple child divs (see here
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
I have a problem with css. I have (parent) div and inside, another (child)
I have a parent div and a child div. The parent div has a
I have one parent DIV inside parent DIV i have two DIV one in
If you have a parent div that wraps a fixed height div and 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.