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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:38:54+00:00 2026-06-18T12:38:54+00:00

I have a mostly fixed 2-column layout: 1st column that takes as much space

  • 0

I have a mostly fixed 2-column layout:

  • 1st column that takes as much space as it needs
  • and the 2nd column that has a fixed width and is floated to the right

I want to make it a responsive design, so in smaller screen sizes, the 2nd column ends below the 1st column. This means that the HTML for the 2nd column has to be after the 1st column.

My problem is that I can’t seem to float the right column properly when using that mark-up. It ends up floated, but is below the main content.

Here’s a sample code:

HTML:

<div class='content'>
    sdaohdosahdaf
    <br />adfafhaskldjs sgdafadkfjas
    <br />saodfhdpaofa]sdoas [fdf asfasfjasfdkasfad;sdlafa dfasds dad gad</div>
<div class='sidebar'>
    daobfhaohfasod agsdjfa
    <br />sidjaofhad
    <br />sojghfadpfjas
</div>

CSS:

.content {
    background-color: lightblue;
    margin-right: 120px;
}
.sidebar {
    float: right;
    width: 120px;
    background-color: lightgreen;
}

JS fiddle here: http://jsfiddle.net/zinkkrysty/U3fA8/

I tried also using negative margins, but can’t seem to do it.

If you have any other approaches to my problem (except setting a width on the first column), please give it a go

  • 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-18T12:38:55+00:00Added an answer on June 18, 2026 at 12:38 pm

    Put them into a parent and set the position of the side bar as absolute, then use a different set of styles for the responsive display

    html

    <div class="parent">
        <div class='content'>
            sdaohdosahdaf
            <br />adfafhaskldjs sgdafadkfjas
            <br />saodfhdpaofa]sdoas [fdf asfasfjasfdkasfad;sdlafa dfasds dad gad
        </div>
        <div class='sidebar'>
            daobf haohf asod agsdjfa
            <br />sidja ofhad
            <br />sojgh fadpfjas
        </div>
    </div>
    

    css

    .parent {
        position: relative;
    }
    .content {
        background-color: lightblue;
        margin-right: 120px;
    }
    .sidebar {
        position: absolute;
        top: 0px;
        right: 0px;
        width: 120px;
        background-color: lightgreen;
    }
    /* Responsive bit */
    @media only screen and (max-width: 320px) {
        .content {
            background-color: orange;
            margin-right: 0px;
        }
        .sidebar {
            background-color: red;
            position: relative;
            width: 100%;
        }
    }
    

    Example

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

Sidebar

Related Questions

I look for a LayoutManager that has fixed height JButtons that expand in width
I'm about to walk into a project that will have files (mostly PHP) behind
i have hundreds of [mostly different] files in many different directories that all have
I have a POCO class that is mostly built through a service. I hit
I have encountered a problem in my program that has me somewhat stumped. I
I have an Activity that mostly consists of a large MapView. On top of
What are efficient ways to sort arrays that have mostly a small set of
I have an application that has a middle panel that always changes depending on
I have mostly all of my forms for different controllers in a jquery dialog
friends I am new to iphone development, I have mostly worked with Android, now

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.