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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:06:18+00:00 2026-05-31T02:06:18+00:00

So, I have this, when the screen is resized, the floater should move to

  • 0

So, I have this, when the screen is resized, the floater should move to the left. Simple enough – but I want it below the content element – any easy way to accomplish that?

Since DOM order can’t change without javascript – is there a way to have it display the same (floater is floated to the right), but have the inner elements in different order?

The floater cannot have a set height, only width.

I tried doing it position absolute and change the DOM order, it mostly worked, but then the floater has to be lower (in px) than the content div, which is not the case for me, it gets over the content below.

Any ideas?

.floater
{
    float: right; 
    width: 300px;
    background-color: gray;
}
@media screen and (max-width: 650px) {
    .floater
    {
        float: left;
    }
}

<div>
    <div class="floater"></div>
    <div>
        content content content content content content content content content content content content content content content content content content content content 
    </div>
</div>
  • 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-31T02:06:19+00:00Added an answer on May 31, 2026 at 2:06 am

    Update

    Given your comments, we are more or less back to basics now 🙂

    We’re setting the main content to take up the entire width but leave 300px on the right side with margin. Width defaults to auto and results in a liquidy feel when resized above the @media treshold; I’m going to float it left too to make it play nicely with the next column:

    .content-main {float:left; margin-right:300px;}
    

    Now, for the sidebar. We know that it’s 300px wide, and we also know that there is that much space available right next to the main content. That area, however, is taken up by the main content’s margin, effectively “pushing” the sidebar down. We’ll just handle it with a negative margin:

    .content-secondary {float: left; width: 300px; margin-left:-300px;}
    

    Because of the way dimensions worked out for us so far, it doesn’t actually matter (for this scenario at least) whether the sidebar is floated left or right. Personally I’d stick with “stacking” it in one direction which would be of benefit if you were to add yet another column.

    Updated version here: http://jsfiddle.net/6VpTR/76/

    Original Answer

    Note that in your original code the right column would interfere with the main content because of the manner in which floating elements interact with non-floating ones. I’d strongly suggest looking into using an existing framework where the kinks have been worked out maybe cssgrid.net or 960.gs

    That being said, see this fiddle here: http://jsfiddle.net/6VpTR/

    As you can see I’m strongly in favour of semantic class names, and your original concern gets addressed by some html restructuring as well as creative use of floating and margins. Gutters should be added if you do not go with a pre-defined grid framework.

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

Sidebar

Related Questions

I have this code to draw an ellipse in the screen but I don't
I have a simple app with a full screen UIWebView. This contains HTML generated
i have this GUI screen shots from the design team which i needs to
I have seen this question: Are there any decent UI components for touch screen
I have a login screen that I force to be ssl, so like this:
I have an application. First I display a splash screen, a form, and this
OK, this is a slightly weird question. We have a touch-screen application (i.e., no
I have this code in jQuery, that I want to reimplement with the prototype
I know this has to be simple, but it's driving me crazy. I'm trying
I have this idea for a free backup application. The largest problem I need

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.