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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:50:51+00:00 2026-06-11T21:50:51+00:00

I’m trying to make a layout where I have a Div that gets added

  • 0

I’m trying to make a layout where I have a Div that gets added its content in a dynamic way. I want this “parent” div to have a fixed height and when content its added the div grows horizontally as needed.

This is the test HTML I made to isolate the problem.

<html>
<head>
  <link rel="stylesheet" href="styletest.css" />
</head>
<body>
  <div style="width:700px;overflow:auto">
    <div class="anio">
      <div class = "semestre">
        <div class="floater"></div>
        <div class="floater"></div>
        <div class="floater"></div>
        <div class="floater"></div>
        <div class="floater"></div>
        <div class="floater"></div>
        <div class="floater"></div>
      </div>
    </div>
  </div>    
</body>
</html>

Here i have 7 class=floater divs that go into the class=semestre container div which is supposed to grow horizontally as I add more class=floater divs. all of this goes into a fixed width div with overflow-x:auto.

after some fighting with the css i managed the following:

div.floater { 
    margin: 4px;
    width: 110px;
    height: 82px;
    border: 1px solid #ccc;
    display: inline-block; /*this to make the floaters go horizontal*/
}
div.semestre{  
    white-space: nowrap; /* this avoid the floater overflowing under the parent div*/
    margin-top: 5px;
    margin: 2px;
    height: 90px;
    border: 1px solid #ccc;
    min-width:98%;

}
div.anio{
    margin : 2px;
    border: 1px solid #ccc;
    min-width:98%;

}

So this worked..kind of.. the class=floater divs go horizontal and cause the activation of the overflow-x on the outermost div, but the container divs that contain the class=floater div don’t grow as i think the should (this can be seen by the borders not growing). After googling I found some proposed solutions like adding width:auto on top of the min-width: css property or floating them, but none worked. This is a minor issue since the borders are just for formatting.

The mayor problem I’m having is when I try to add content to the class=floater divs they just go CRAZY and won’t stay where they should( when they had no content). i tried reverting the white-space:nowrap by adding white-space:normal to the floater class but that didn’t work. After that I just went berserk and started trying random stuff and managed to fix my first problem but the I forgot what I did and went back to step 1 D:.

To be honest I’m very new to html/css and I’m learning by doing. So if this question has been already asked/answered believe me that I searched for it. Also excuse my English, doing my best.

Thank you for your time.

edit:
By request, the fiddle 😀 http://jsfiddle.net/UBYKy/1/
there you can see both of my problems.

edit 2: i believe i have found a solution to both problems. For the first one I solved it by adding display: inline-block to the parent divs and for the 2nd problem I added vertical-lign:top to the floater class css(as afshin suggested) and it works just fine. I hope this helps anyone having the same problem.

  • 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-11T21:50:53+00:00Added an answer on June 11, 2026 at 9:50 pm

    I think you should use this

    div.floater { 
     vertical-align:top;
     margin: 4px;
     min-width:110px;
     width: auto;
     height: 82px;
     border: 1px solid #ccc;
     display: inline-block; /*this to make the floaters go horizontal*/
    }
    

    DEMO

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I'm trying to select an H1 element which is the second-child in its group
I know there's a lot of other questions out there that deal with this

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.