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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:39:02+00:00 2026-05-20T18:39:02+00:00

I currently have a setup of divs within a container div, as follows: <div

  • 0

I currently have a setup of divs within a container div, as follows:

<div id="container">  
    <div id="element"> Element 1 content </div>  
    <div id="element"> Element 2 content </div>  
    <div id="element"> Element 3 content </div>  
    <div id="element"> Element 4 content </div>  
</div>

style.css:

.container {
width:200px;
overflow-x:auto;
overflow-y:hidden;
}  

.element {
width:100px;
float:left;
}

Here’s a jsFiddle of the code: http://jsfiddle.net/vZWTc/.

So, I would like each of the elements to line up next to each other (all 4 in one row), but only have the first two visible (container is 200px, each element is 100px, so only 2 are visible at a time), while the user can scroll (horizontally) to the 3rd and 4th elements (as they are less important)

However, with this setup, elements 3 and 4 wrap down to the next line

updating the container class with white-space:nowrap does nothing. That only affects text, not divs apparently.

Any ideas? Thanks in advance!

  • 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-20T18:39:03+00:00Added an answer on May 20, 2026 at 6:39 pm

    Use a wrapper div with the total width of the 4 elements, and set the container to hidden overflow, html example…

    <div class="container">
      <div class="wrapper">
        <div class="element"> Element 1 content </div>
        <div class="element"> Element 2 content </div>
        <div class="element"> Element 3 content </div>
        <div class="element"> Element 4 content </div>
      </div>
    </div>
    

    and for the css

    .container { width:200px; overflow-x:auto; overflow-y:hidden; }
    .wrapper { width: 400px; }
    .element { width:100px; float:left; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a simple setup: a centered container div that is 90% width
I currently have a div whose css looks like this: .class { overflow:auto; resize:
I currently have mirroring setup between three computers, principle, mirror, and witness. During the
I currently have replication setup on MySQL 4.1 (master, named radius) to MySQL 5.0
I currently have a news website setup in PHP/MYSQL that's a bit old and
We currently have a single installation multi-site setup, hosted in Europe, and are looking
I have setup hadoop on top of mongodb using hadoop-mongodb driver. Currently I can
I need some advice of how to setup my tables I currently have a
Currently I have a distribution provision setup on my laptop to distribute enterprise app
currently I'm trying to have a setup where a generic database is distributed to

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.