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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:11:04+00:00 2026-06-07T23:11:04+00:00

Please see this jsFiddle: http://jsfiddle.net/jRGyS/ I want to create two columns from the blocks,

  • 0

Please see this jsFiddle: http://jsfiddle.net/jRGyS/

I want to create two columns from the blocks, with the even (lime) blocks floating right and the odd (blue) blocks floating left. However, the layout can get a bit messy when the blocks vary in height, as you can see the last blue block is floating up against another blue block, but this blue block should either stay left, or instead float right.

The problem is that these blocks will be loaded in dynamically, and always vary in height. So you can never predict how many there will be, what height each one will be, and the order in which they appear (except for maybe with Javascript after the DOM has loaded).

An idea case would be without Javascript, but if that’s not possible, JS can be used.

  • 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-07T23:11:06+00:00Added an answer on June 7, 2026 at 11:11 pm

    Use clear:left and clear:right as in this JSFiddle

    div.block {
       background: blue;
       width: 100px;
       height: 100px;
       margin-bottom: 10px; 
    }
    div.block:nth-child(odd) {
       float: left;            
       clear: left;
    }
    div.block:nth-child(even) {
       background: lime;   
       float: right;            
       clear: right;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see this simple fiddle http://jsfiddle.net/75qSD/ I want it to decorate the element as
Please see this: http://jsfiddle.net/uNbYu/1/ If you click submit, the button doesn't do anything, but
please see this example http://jsfiddle.net/7trcV/ what I'm trying to achieve is ability to put
Please check out this jsfiddle http://jsfiddle.net/rr4GH/1/ As you can see its a round edge
Please see the solution to another question provided by ud3323: http://jsfiddle.net/ud3323/ykL69/ . This solution
Please see this : http://jsfiddle.net/ymSpY/ . If you can see <td> has an inner
Please see this: My code looks like this now: http://jsfiddle.net/Bd9Ut/ As you can see
I need some help with this accordion. Please see the demo here. http://jsfiddle.net/a36RL/ $(document).ready(function()
Please see this http://jsfiddle.net/yv8uw/1/ When you click View all Comments the box opens up
Please take a look at this fiddle: http://jsfiddle.net/hughbe/QYGcq/ As you can see, the label

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.