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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:16:15+00:00 2026-06-07T10:16:15+00:00

I have got a couple of boxes containing text which should be displayed next

  • 0

I have got a couple of boxes containing text which should be displayed next to each other. They all have a fixed width, but a variable height (depending on their content). They are inside of a container with a variable width.

If there are too many boxes I want them to jump into the next line and start from the left again. I realized this using left floated boxes. This causes a problem if the first box per line is higher than the next one, because then the ones from the new line won’t start from the left. Here’s a demo:

HTML:

<section>
    <article>One: This ​​​​text is so long, it's so long oh my gosh!</article>
    <article>Two</article>
    <article>Three: bla bla bla bla bla bla bla bla</article>
    <article>Four</article>
</section>​

CSS:

section{
    width: 300px; /* For demo, this can vary */
    overflow: hidden;
}
article{
    float: left;
    width: 100px;
    background: #dddddd;
    padding: 10px;
    margin: 10px;
}
​

You can also have a look at this JSFiddle, where you can see the problem immediately: http://jsfiddle.net/dwr6K/ Box “Three” starts right from Box “One”, although I’d like it to start in the new line under Box “One”. Sadly I can’t use clear: left because I don’t know how many boxes will fit in a line.

Is there a way to prevent this and to display it the way I’d like to?

  • 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-07T10:16:17+00:00Added an answer on June 7, 2026 at 10:16 am

    Here: http://jsfiddle.net/dwr6K/9/

    Just remove float: left;

    and add

    display: inline-block;
    vertical-align: top;
    

    to article.

    As @JimmyX pointed out, do go through this post about Cross-Browser Inline-Block

    Basically, what float:left does is it makes each element stick next to the leftmost div it can find. And hence if the heights vary, you don’t get the desired layout.

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

Sidebar

Related Questions

I have a couple of text boxes that accept numeric values. When a user
I've got this here wizard step with a couple of text boxes. For some
In my code, I have got function templates containing lambda expressions which depend on
I've got a couple of colleagues who love Access and have lots of important
I've possible got to implement SAML for a couple of sites we have and
I'm a couple weeks into iOS programming, and have lots to learn. I've got
I have got a form into which information is entered, and a drop down
I have got a table [newsletter] in the db, which saves the email address,
I have got an(other) error while trying to upgrade our large project to SL4.
Hi I've got a couple of questions regarding associations and how they play 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.