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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:46:46+00:00 2026-06-12T17:46:46+00:00

I have sidebars which can be turned on and off on specific pages, but

  • 0

I have sidebars which can be turned on and off on specific pages, but I am trying to design a CSS layout that fills up the available space regardless of what sidebars are enabled. I have this so far:

CSS:

#container{
    width: 100%;
}
#sidebar-left, #sidebar-right, #content{
    height: 50px;

}
#sidebar-right{
    background: gray;
    width: 50px;
    float: right;
}

#sidebar-left{
    background: yellow;
    width: 50px;
    float: left;
}

#content{
    background: orange;
}

​
HTML:

<div id="container">
    <div id="content">content content content content content content content
        <div id="sidebar-left">sidebar</div>
        <div id="sidebar-right">sidebar</div>
    </div>
</div>

JSFiddle link:
LINK

The problem is the right column overlaps the main content column. However, I still want to keep the middle column at 100% so it fills up all the space when one of the sidebars is disabled.

  • 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-12T17:46:48+00:00Added an answer on June 12, 2026 at 5:46 pm

    Add a container that holds your main content, and apply overflow: hidden to it in order to apply a new block formatting context to it. You’ll need to rearrange the elements slightly. See below:

    HTML

    <div id="container">
        <div id="content">
            <div id="sidebar-left">sidebar</div>
            <div id="sidebar-right">sidebar</div>
            <div id="col-main">content content content content content content content contente conte tnoe o toa nao no ton oanota ona</div>
        </div>
    </div>
    

    ​CSS

    #container {
        width: 100%;
    }
    
    #sidebar-left, #sidebar-right, #content {
        height: 50px;
    
    }
    #sidebar-right {
        background: gray;
        width: 50px;
        float: right;
    }
    
    #sidebar-left {
        background: yellow;
        width: 50px;
        float: left;
    }
    
    #content {
        background: orange;
        height: auto;
    }
    
    #col-main {
        overflow:hidden;
    }
    

    ​

    Here’s a jsfiddle demonstrating it with columns: http://jsfiddle.net/aBbtN/8/

    and without: http://jsfiddle.net/aBbtN/10/

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

Sidebar

Related Questions

I have a sidebar in my app that can be hidden/shown via a toggle
on my website I have a sidebar panel, which has two tabs that when
I have a classifieds website, which uses PHP and MYSQL. I have several pages
I have an app in which the user can change the background image of
I have a layout in which i'm using the content_for tag to render some
This one's trickier to explain: I have ClassA which has MethodA , that does
What i'm trying to do is have a sidebar toggle open and close which
I have a form which is in a sidebar, and shows on multiple pages.
I have found many a post on this, but I can't get it. I
I have a function that which process the side bar of a web page

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.