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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:26:51+00:00 2026-06-01T20:26:51+00:00

I have a left floating div which serves as a sidebar (red). Next to

  • 0

I have a left floating div which serves as a sidebar (red). Next to it, there is another div that stores the page content (green). The elements inside the content div are left floating (blue).

I want to be able to scroll the boxes horizontally when the browser width is too small to accommodate them; for example if there are a lot of boxes. Instead, the content div moves below the sidebar div and I am scrolling the whole page.

Here is the page layout when the browser window is wide enough:
Page Layout

Here is the HTML:

<div id="container">
  <div id="sidebar">Sidebar</div>
  <div id="content">
    <p class="box">Box 1</p>
    <p class="box">Box 2</p>
    <p class="box">Box 3</p>
  </div>
  <div style="clear: both;"></div>
</div>

And here is the CSS:

* {
    margin: 0px;
    padding: 0px;
}

#container {
    background: yellow;
}

#sidebar {
    float: left;
    background: red;
}

#content {
    float: left;
    white-space: nowrap;
    background: green;
}

.box {
    width: 200px;
    height: 250px;
    background: blue;
    margin: 10px;
    float: left;
}

Please help me understand what am I doing wrong. Thank you.

  • 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-01T20:26:52+00:00Added an answer on June 1, 2026 at 8:26 pm

    You simply need something to wrap your content with the CSS property overflow-x: scroll;.

    **Important: This is a CSS3 feature and some browsers may not support overflox-x. Therefore, I highly suggest you read the following: http://net.tutsplus.com/tutorials/html-css-techniques/html5-and-css3-without-guilt/.

    Preview: http://jsfiddle.net/WXFJU/

    HTML

    <div id="container">
      <div id="sidebar">Sidebar</div>
      <div class="overflow-x">
          <div id="content">
            <p class="box">Box 1</p>
            <p class="box">Box 2</p>
            <p class="box">Box 3</p>
          </div>
      </div>
      <div style="clear: both;"></div>
    </div>​​​​​
    

    CSS

    * {
        margin: 0px;
        padding: 0px;
    }
    
    #container {
        width: 100%;
        background: yellow;
    }
    
    #sidebar {
        float: left;
        background: red;
    }
    
    #content {
        float: left;
        white-space: nowrap;
        background: green;
    }
    
    .box {
        width: 200px;
        height: 250px;
        background: blue;
        margin: 10px;
        float: left;
    }
    
    .overflow-x {
        overflow-x: scroll;
        display: block;
    }
    

    ​

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

Sidebar

Related Questions

In my web page, I have a div that stays static on the left
Suppose I have an div. Inside this div, I have two divs floating left,
I have a left-positioned navigation that shows/hides content on the right. Currently, when you
I'm floating a sidebar to the left of the main content panel. Then inside
I have two div's in a container div, one floating left, one floating right.
A common problem that I have with web pages is floating div tags creeping
I have two div's which classes are left and right. left is floated to
I have a div in my HTML page which I want to act like
I have created a simple grid of divs by left floating them and an
I have a page with elements, with relative position. style=position: relative; Some have top/left

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.