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

The Archive Base Latest Questions

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

Given a DIV with several inner-DIVs: <div id=parent> <div id=a></div> <div id=b></div> </div> All

  • 0

Given a DIV with several inner-DIVs:

<div id="parent">
 <div id="a"></div>
 <div id="b"></div>
</div>

All DIVs are to have the same width, whereas it should be the width of the broadest DIV. The parent element has no explicit width.

How can I achieve that?

I thought width: 100% would do it, but it will stretch the parent element to window size.

Sketch:

################
#**************#
#*aaaaaaaaaaaa*#
#**************#
#*********     #
#*bbbbbbb*     #
#*********     #
################

should be

################
#**************#
#*aaaaaaaaaaaa*#
#**************#
#**************#
#*bbbbbbb     *#
#**************#
################

# represents the parent DIV, which does not fill the whole window.

  • 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-18T22:27:29+00:00Added an answer on May 18, 2026 at 10:27 pm

    First off, this type of CSS related question is perfect for the SO sister site DocType, which focuses on CSS and website design.

    As for your problem, divs are block level elements and therefore stretch to all given space. If this is not happening, it means that there is something else overriding this. For a quick fix, add the following:

    #parent {
        position: relative;
    }
    

    And it might fix your situation. If it does not, then you’ll have some conflicts in you CSS somewhere and by maybe giving some code or a more specific example, we might be able to help more. Again, though, as detailed in the SO FAQ, DocType is more suited for questions like this.

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

Sidebar

Related Questions

Given a relatively simple CSS: div { width: 150px; } <div> 12333-2333-233-23339392-332332323 </div> How
Given this HTML snippet: <div id=box style=overflow:auto; width:200px; height:200px; border:1px solid black;> 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br> 11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>
Given: <div class=subHead>Stock Options</div> <table class=settingTable> <tr> <td colspan=2><b>Limited Stock</b></td> </tr> <tr> <td width=50
I have a div with several images inside, and I would like to center
Given this HTML: <div>foo</div><div>bar</div><div>baz</div> How do you make them display inline like this: foo
Given the following XML structure <html> <body> <div> <span>Test: Text2</span> </div> <div> <span>Test: Text3</span>
What is the best way to make a <div> fade away after a given
I've a HTML page with several Div's that will show the time difference between
I have a project where I need to give the users several different sets
I am trying to accomplish to show a div that is in the same

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.